__
/\ \ __
__ __ ___ \_\ \ __ _ __ ____ ___ ___ _ __ __ /\_\ ____
/\ \/\ \ /' _ `\ /'_ \ /'__`\/\ __\/ ,__\ / ___\ / __`\/\ __\/'__`\ \/\ \ /',__\
\ \ \_\ \/\ \/\ \/\ \ \ \/\ __/\ \ \//\__, `\/\ \__//\ \ \ \ \ \//\ __/ __ \ \ \/\__, `\
\ \____/\ \_\ \_\ \___,_\ \____\\ \_\\/\____/\ \____\ \____/\ \_\\ \____\/\_\ _\ \ \/\____/
\/___/ \/_/\/_/\/__,_ /\/____/ \/_/ \/___/ \/____/\/___/ \/_/ \/____/\/_//\ \_\ \/___/
\ \____/
\/___/
Underscore.js is a utility-belt library for JavaScript that provides support for the usual functional suspects (each, map, reduce, filter...) without extending any core JavaScript objects. It's available in ES6 and UMD (cjs, amd, iife) formats
ES6 & Beyond usage:
- partial importation of features (just import what you need, with a name that suits you).
; var basicTemplate = ;var result = ;console; // => "Ok, i use rollup for my es6 and beyond stuff !"
nb: only _chain
isn't available in this case.
another way to use chaining feature here is through _compose
or _use
.
;;;;; {return 'result: '+ num + 10 + " / 20"}var test = // or simply .do([], [].concat, [10, 14]) value;console;// => result: 20 / 20
import features depending of their category
;;;;; console;// => [4, 7, 0, 3]
- global importation of all features
; // or from 'underscore-es/_namespace' _ value // => 0
- breaking changes
Since this underscore source code has been rewritten to be more es6 friendly :
the _.templateSettings
property is now _.template.settings
; _templatesettings = evaluate: /\{\{\}\}/g interpolate: /\{\{=\}\}/g; var custom = ;var result = ;console;// => <ul><li>Moe</li><li>Larry</li><li>Curly</li></ul>
the _.iteratee
shall now (for global importation) be overwritten through _.setIteratee([fn])
method
;;;; ; // test some methods that claim to be transformed through `_iteratee`var collection = 'foo' 'bar' 'bbiz';console// => {0: 1, 1: 1, 2: 1}console// => ['bar', 'bbiz']
Documentation is the place to find what you need to know !
This project adheres to a code of conduct. By participating, you are expected to uphold this code.
For support and questions, please use the gitter channel or stackoverflow
Underscore is an open-sourced component of DocumentCloud: https://github.com/documentcloud
Many thanks to our contributors: https://github.com/tnga/underscore-es/contributors https://github.com/jashkenas/underscore/contributors