-
Underscore
_.each(array, iteratee)
-
ES5.1
array.forEach(iteratee)
-
Underscore
_.map(array, iteratee)
-
ES5.1
array.map(iteratee)
-
Underscore
_.reduce(array, iteratee, memo)
-
ES5.1
array.reduce(iteratee, memo)
-
Underscore
_.reduceRight(array, iteratee, memo)
-
ES5.1
array.reduceRight(iteratee, memo)
-
Underscore
_.every(array, predicate)
-
ES5.1
array.every(predicate)
-
Underscore
_.some(array, predicate)
-
ES5.1
array.some(predicate)
-
Underscore
_.find(array, predicate)
-
ES2015
array.find(predicate)
-
Underscore
_.pluck(array, propertyName)
-
ES2015
array.map(value => value[propertyName])
-
Underscore
_.includes(array, element)
-
ES2016
array.includes(element)
-
Underscore
_.toArray(arguments)
-
ES2015
[...arguments]
-
Underscore
_.object(array)
-
ES2015
array.reduce((result, [key, val]) => Object.assign(result, {[key]: val}), {})
-
Object Rest/Spread (Stage 2)
array.reduce((result, [key, val]) => {...result, [key]: val}, {})
-
Underscore
_.compact(array)
-
ES5.1
array.filter(Boolean)
-
ES2015
array.filter(x => !!x)
-
Underscore
_.uniq(array)
-
ES2015
[...new Set(array)]
-
Underscore
_.indexOf(array, value)
-
ES5.1
array.indexOf(value)
-
Underscore
_.findIndex([4, 6, 7, 12], isPrime);
-
ES2015
[4, 6, 7, 12].findIndex(isPrime);
-
Underscore
_.range(x, x + n)
-
ES2015
Array.from(Array(n), (_, i) => x + i)
-
Underscore
_.keys(object)
-
ES5.1
Object.keys(object)
-
Underscore
_.size(object)
-
ES5.1
Object.keys(object).length
-
Underscore
_.allKeys(object)
-
ES2015
[...Reflect.enumerate(object)]
-
Underscore
_.values(object)
-
ES2015
Object.keys(object).map(key => object[key])
-
ES2017
Object.values(object)
-
Underscore
_.create(proto, properties)
-
ES2015
Object.assign(Object.create(proto), properties)
-
Underscore
_.assign({}, source, { a: false })
-
ES2015
Object.assign({}, source, { a: false })
-
Object Rest/Spread (Stage 2)
{ ...source, a: false }
-
Underscore
_.extendOwn({}, object)
-
Object Rest/Spread (Stage 2)
{ ...object }
-
Underscore
_.isArray(object)
-
ES5.1
Array.isArray(object)
-
Underscore
_.isNumber(object) && _.isFinite(object)
-
ES2015
Number.isFinite(object)
-
Underscore
foo(_.bind(function () { this.bar(); }, this)); foo(_.bind(object.fun, object));
-
ES2015
foo(() => { this.bar(); }); foo(() => object.fun());
-
Underscore
_.identity
-
ES2015
value => value
-
Underscore
_.constant(value)
-
ES2015
() => value
-
Underscore
_.noop
-
ES2015
() => {}
-
Underscore
_.now()
-
ES5.1
Date.now()
-
Underscore
var greeting = _.template("hello <%= name %>"); greeting({ name: 'moe' });
-
ES2015
const greeting = ({ name }) => `hello ${name}`; greeting({ name: 'moe' });