mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 01:47:48 +00:00
Update doc examples to ES2015.
This commit is contained in:
11
after.js
11
after.js
@@ -11,15 +11,10 @@ import toInteger from './toInteger.js';
|
|||||||
* @returns {Function} Returns the new restricted function.
|
* @returns {Function} Returns the new restricted function.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var saves = ['profile', 'settings'];
|
* const saves = ['profile', 'settings'];
|
||||||
|
* const done = after(saves.length, () => console.log('done saving!'));
|
||||||
*
|
*
|
||||||
* var done = after(saves.length, function() {
|
* forEach(saves, type => asyncSave({ 'type': type, 'complete': done }));
|
||||||
* console.log('done saving!');
|
|
||||||
* });
|
|
||||||
*
|
|
||||||
* forEach(saves, function(type) {
|
|
||||||
* asyncSave({ 'type': type, 'complete': done });
|
|
||||||
* });
|
|
||||||
* // => Logs 'done saving!' after the two async saves have completed.
|
* // => Logs 'done saving!' after the two async saves have completed.
|
||||||
*/
|
*/
|
||||||
function after(n, func) {
|
function after(n, func) {
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import keysIn from './keysIn.js';
|
|||||||
* return isUndefined(objValue) ? srcValue : objValue;
|
* return isUndefined(objValue) ? srcValue : objValue;
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* var defaults = partialRight(assignInWith, customizer);
|
* const defaults = partialRight(assignInWith, customizer);
|
||||||
*
|
*
|
||||||
* defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
|
* defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
|
||||||
* // => { 'a': 1, 'b': 2 }
|
* // => { 'a': 1, 'b': 2 }
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import keys from './keys.js';
|
|||||||
* return isUndefined(objValue) ? srcValue : objValue;
|
* return isUndefined(objValue) ? srcValue : objValue;
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* var defaults = partialRight(assignWith, customizer);
|
* const defaults = partialRight(assignWith, customizer);
|
||||||
*
|
*
|
||||||
* defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
|
* defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
|
||||||
* // => { 'a': 1, 'b': 2 }
|
* // => { 'a': 1, 'b': 2 }
|
||||||
|
|||||||
2
at.js
2
at.js
@@ -10,7 +10,7 @@ import baseAt from './.internal/baseAt.js';
|
|||||||
* @returns {Array} Returns the picked values.
|
* @returns {Array} Returns the picked values.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
|
* const object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
|
||||||
*
|
*
|
||||||
* at(object, ['a[0].b.c', 'a[1]']);
|
* at(object, ['a[0].b.c', 'a[1]']);
|
||||||
* // => [3, 4]
|
* // => [3, 4]
|
||||||
|
|||||||
@@ -13,9 +13,8 @@ import isError from './isError.js';
|
|||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* // Avoid throwing errors for invalid selectors.
|
* // Avoid throwing errors for invalid selectors.
|
||||||
* var elements = attempt(function(selector) {
|
* const elements = attempt(selector =>
|
||||||
* return document.querySelectorAll(selector);
|
* document.querySelectorAll(selector), '>_>');
|
||||||
* }, '>_>');
|
|
||||||
*
|
*
|
||||||
* if (isError(elements)) {
|
* if (isError(elements)) {
|
||||||
* elements = [];
|
* elements = [];
|
||||||
|
|||||||
6
bind.js
6
bind.js
@@ -28,14 +28,14 @@ const WRAP_PARTIAL_FLAG = 32;
|
|||||||
* return greeting + ' ' + this.user + punctuation;
|
* return greeting + ' ' + this.user + punctuation;
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* var object = { 'user': 'fred' };
|
* const object = { 'user': 'fred' };
|
||||||
*
|
*
|
||||||
* var bound = bind(greet, object, 'hi');
|
* const bound = bind(greet, object, 'hi');
|
||||||
* bound('!');
|
* bound('!');
|
||||||
* // => 'hi fred!'
|
* // => 'hi fred!'
|
||||||
*
|
*
|
||||||
* // Bound with placeholders.
|
* // Bound with placeholders.
|
||||||
* var bound = bind(greet, object, _, '!');
|
* const bound = bind(greet, object, _, '!');
|
||||||
* bound('hi');
|
* bound('hi');
|
||||||
* // => 'hi fred!'
|
* // => 'hi fred!'
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -16,11 +16,9 @@ import toKey from './.internal/toKey.js';
|
|||||||
* @returns {Object} Returns `object`.
|
* @returns {Object} Returns `object`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var view = {
|
* const view = {
|
||||||
* 'label': 'docs',
|
* 'label': 'docs',
|
||||||
* 'click': function() {
|
* 'click': () => console.log(`clicked ${ this.label }`)
|
||||||
* console.log('clicked ' + this.label);
|
|
||||||
* }
|
|
||||||
* };
|
* };
|
||||||
*
|
*
|
||||||
* bindAll(view, ['click']);
|
* bindAll(view, ['click']);
|
||||||
|
|||||||
@@ -27,14 +27,14 @@ const WRAP_PARTIAL_FLAG = 32;
|
|||||||
* @returns {Function} Returns the new bound function.
|
* @returns {Function} Returns the new bound function.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var object = {
|
* const object = {
|
||||||
* 'user': 'fred',
|
* 'user': 'fred',
|
||||||
* 'greet': function(greeting, punctuation) {
|
* 'greet': function(greeting, punctuation) {
|
||||||
* return greeting + ' ' + this.user + punctuation;
|
* return greeting + ' ' + this.user + punctuation;
|
||||||
* }
|
* }
|
||||||
* };
|
* };
|
||||||
*
|
*
|
||||||
* var bound = bindKey(object, 'greet', 'hi');
|
* const bound = bindKey(object, 'greet', 'hi');
|
||||||
* bound('!');
|
* bound('!');
|
||||||
* // => 'hi fred!'
|
* // => 'hi fred!'
|
||||||
*
|
*
|
||||||
@@ -46,7 +46,7 @@ const WRAP_PARTIAL_FLAG = 32;
|
|||||||
* // => 'hiya fred!'
|
* // => 'hiya fred!'
|
||||||
*
|
*
|
||||||
* // Bound with placeholders.
|
* // Bound with placeholders.
|
||||||
* var bound = bindKey(object, 'greet', _, '!');
|
* const bound = bindKey(object, 'greet', _, '!');
|
||||||
* bound('hi');
|
* bound('hi');
|
||||||
* // => 'hiya fred!'
|
* // => 'hiya fred!'
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
* castArray();
|
* castArray();
|
||||||
* // => []
|
* // => []
|
||||||
*
|
*
|
||||||
* var array = [1, 2, 3];
|
* const array = [1, 2, 3];
|
||||||
* console.log(castArray(array) === array);
|
* console.log(castArray(array) === array);
|
||||||
* // => true
|
* // => true
|
||||||
*/
|
*/
|
||||||
|
|||||||
4
clone.js
4
clone.js
@@ -21,9 +21,9 @@ const CLONE_SYMBOLS_FLAG = 4;
|
|||||||
* @see cloneDeep
|
* @see cloneDeep
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var objects = [{ 'a': 1 }, { 'b': 2 }];
|
* const objects = [{ 'a': 1 }, { 'b': 2 }];
|
||||||
*
|
*
|
||||||
* var shallow = clone(objects);
|
* const shallow = clone(objects);
|
||||||
* console.log(shallow[0] === objects[0]);
|
* console.log(shallow[0] === objects[0]);
|
||||||
* // => true
|
* // => true
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -14,9 +14,9 @@ const CLONE_SYMBOLS_FLAG = 4;
|
|||||||
* @see clone
|
* @see clone
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var objects = [{ 'a': 1 }, { 'b': 2 }];
|
* const objects = [{ 'a': 1 }, { 'b': 2 }];
|
||||||
*
|
*
|
||||||
* var deep = cloneDeep(objects);
|
* const deep = cloneDeep(objects);
|
||||||
* console.log(deep[0] === objects[0]);
|
* console.log(deep[0] === objects[0]);
|
||||||
* // => false
|
* // => false
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ const CLONE_SYMBOLS_FLAG = 4;
|
|||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* var el = cloneDeepWith(document.body, customizer);
|
* const el = cloneDeepWith(document.body, customizer);
|
||||||
*
|
*
|
||||||
* console.log(el === document.body);
|
* console.log(el === document.body);
|
||||||
* // => false
|
* // => false
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ const CLONE_SYMBOLS_FLAG = 4;
|
|||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* var el = cloneWith(document.body, customizer);
|
* const el = cloneWith(document.body, customizer);
|
||||||
*
|
*
|
||||||
* console.log(el === document.body);
|
* console.log(el === document.body);
|
||||||
* // => false
|
* // => false
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ import copyArray from './.internal/copyArray.js';
|
|||||||
* @returns {Array} Returns the new concatenated array.
|
* @returns {Array} Returns the new concatenated array.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var array = [1];
|
* const array = [1];
|
||||||
* var other = concat(array, 2, [3], [[4]]);
|
* const other = concat(array, 2, [3], [[4]]);
|
||||||
*
|
*
|
||||||
* console.log(other);
|
* console.log(other);
|
||||||
* // => [1, 2, 3, [4]]
|
* // => [1, 2, 3, [4]]
|
||||||
|
|||||||
6
cond.js
6
cond.js
@@ -13,10 +13,10 @@ import arrayMap from './.internal/arrayMap.js';
|
|||||||
* @returns {Function} Returns the new composite function.
|
* @returns {Function} Returns the new composite function.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var func = cond([
|
* const func = cond([
|
||||||
* [matches({ 'a': 1 }), constant('matches A')],
|
* [matches({ 'a': 1 }), constant('matches A')],
|
||||||
* [conforms({ 'b': isNumber }), constant('matches B')],
|
* [conforms({ 'b': isNumber }), constant('matches B')],
|
||||||
* [stubTrue, constant('no match')]
|
* [stubTrue, constant('no match')]
|
||||||
* ]);
|
* ]);
|
||||||
*
|
*
|
||||||
* func({ 'a': 1, 'b': 2 });
|
* func({ 'a': 1, 'b': 2 });
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ const CLONE_DEEP_FLAG = 1;
|
|||||||
* @returns {Function} Returns the new spec function.
|
* @returns {Function} Returns the new spec function.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var objects = [
|
* const objects = [
|
||||||
* { 'a': 2, 'b': 1 },
|
* { 'a': 2, 'b': 1 },
|
||||||
* { 'a': 1, 'b': 2 }
|
* { 'a': 1, 'b': 2 }
|
||||||
* ];
|
* ];
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import keys from './keys.js';
|
|||||||
* @returns {boolean} Returns `true` if `object` conforms, else `false`.
|
* @returns {boolean} Returns `true` if `object` conforms, else `false`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var object = { 'a': 1, 'b': 2 };
|
* const object = { 'a': 1, 'b': 2 };
|
||||||
*
|
*
|
||||||
* conformsTo(object, { 'b': function(n) { return n > 1; } });
|
* conformsTo(object, { 'b': function(n) { return n > 1; } });
|
||||||
* // => true
|
* // => true
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
* @returns {Function} Returns the new constant function.
|
* @returns {Function} Returns the new constant function.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var objects = times(2, constant({ 'a': 1 }));
|
* const objects = times(2, constant({ 'a': 1 }));
|
||||||
*
|
*
|
||||||
* console.log(objects);
|
* console.log(objects);
|
||||||
* // => [{ 'a': 1 }, { 'a': 1 }]
|
* // => [{ 'a': 1 }, { 'a': 1 }]
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import baseCreate from './.internal/baseCreate.js';
|
|||||||
* 'constructor': Circle
|
* 'constructor': Circle
|
||||||
* });
|
* });
|
||||||
*
|
*
|
||||||
* var circle = new Circle;
|
* const circle = new Circle;
|
||||||
* circle instanceof Circle;
|
* circle instanceof Circle;
|
||||||
* // => true
|
* // => true
|
||||||
*
|
*
|
||||||
|
|||||||
4
curry.js
4
curry.js
@@ -23,11 +23,11 @@ const WRAP_CURRY_FLAG = 8;
|
|||||||
* @returns {Function} Returns the new curried function.
|
* @returns {Function} Returns the new curried function.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var abc = function(a, b, c) {
|
* const abc = function(a, b, c) {
|
||||||
* return [a, b, c];
|
* return [a, b, c];
|
||||||
* };
|
* };
|
||||||
*
|
*
|
||||||
* var curried = curry(abc);
|
* const curried = curry(abc);
|
||||||
*
|
*
|
||||||
* curried(1)(2)(3);
|
* curried(1)(2)(3);
|
||||||
* // => [1, 2, 3]
|
* // => [1, 2, 3]
|
||||||
|
|||||||
@@ -20,11 +20,11 @@ const WRAP_CURRY_RIGHT_FLAG = 16;
|
|||||||
* @returns {Function} Returns the new curried function.
|
* @returns {Function} Returns the new curried function.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var abc = function(a, b, c) {
|
* const abc = function(a, b, c) {
|
||||||
* return [a, b, c];
|
* return [a, b, c];
|
||||||
* };
|
* };
|
||||||
*
|
*
|
||||||
* var curried = curryRight(abc);
|
* const curried = curryRight(abc);
|
||||||
*
|
*
|
||||||
* curried(3)(2)(1);
|
* curried(3)(2)(1);
|
||||||
* // => [1, 2, 3]
|
* // => [1, 2, 3]
|
||||||
|
|||||||
@@ -50,8 +50,8 @@ const nativeMin = Math.min;
|
|||||||
* }));
|
* }));
|
||||||
*
|
*
|
||||||
* // Ensure `batchLog` is invoked once after 1 second of debounced calls.
|
* // Ensure `batchLog` is invoked once after 1 second of debounced calls.
|
||||||
* var debounced = debounce(batchLog, 250, { 'maxWait': 1000 });
|
* const debounced = debounce(batchLog, 250, { 'maxWait': 1000 });
|
||||||
* var source = new EventSource('/stream');
|
* const source = new EventSource('/stream');
|
||||||
* jQuery(source).on('message', debounced);
|
* jQuery(source).on('message', debounced);
|
||||||
*
|
*
|
||||||
* // Cancel the trailing debounced invocation.
|
* // Cancel the trailing debounced invocation.
|
||||||
|
|||||||
4
defer.js
4
defer.js
@@ -11,9 +11,7 @@ import baseDelay from './.internal/baseDelay.js';
|
|||||||
* @returns {number} Returns the timer id.
|
* @returns {number} Returns the timer id.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* defer(function(text) {
|
* defer(text => console.log(text), 'deferred');
|
||||||
* console.log(text);
|
|
||||||
* }, 'deferred');
|
|
||||||
* // => Logs 'deferred' after one millisecond.
|
* // => Logs 'deferred' after one millisecond.
|
||||||
*/
|
*/
|
||||||
function defer(func, ...args) {
|
function defer(func, ...args) {
|
||||||
|
|||||||
4
delay.js
4
delay.js
@@ -13,9 +13,7 @@ import toNumber from './toNumber.js';
|
|||||||
* @returns {number} Returns the timer id.
|
* @returns {number} Returns the timer id.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* delay(function(text) {
|
* delay(text => console.log(text), 1000, 'later');
|
||||||
* console.log(text);
|
|
||||||
* }, 1000, 'later');
|
|
||||||
* // => Logs 'later' after one second.
|
* // => Logs 'later' after one second.
|
||||||
*/
|
*/
|
||||||
function delay(func, wait, ...args) {
|
function delay(func, wait, ...args) {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import last from './last.js';
|
|||||||
* @returns {Array} Returns the new array of filtered values.
|
* @returns {Array} Returns the new array of filtered values.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
|
* const objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
|
||||||
*
|
*
|
||||||
* differenceWith(objects, [{ 'x': 1, 'y': 2 }], isEqual);
|
* differenceWith(objects, [{ 'x': 1, 'y': 2 }], isEqual);
|
||||||
* // => [{ 'x': 2, 'y': 1 }]
|
* // => [{ 'x': 2, 'y': 1 }]
|
||||||
|
|||||||
@@ -12,13 +12,13 @@ import baseWhile from './.internal/baseWhile.js';
|
|||||||
* @returns {Array} Returns the slice of `array`.
|
* @returns {Array} Returns the slice of `array`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var users = [
|
* const users = [
|
||||||
* { 'user': 'barney', 'active': true },
|
* { 'user': 'barney', 'active': true },
|
||||||
* { 'user': 'fred', 'active': false },
|
* { 'user': 'fred', 'active': false },
|
||||||
* { 'user': 'pebbles', 'active': false }
|
* { 'user': 'pebbles', 'active': false }
|
||||||
* ];
|
* ];
|
||||||
*
|
*
|
||||||
* dropRightWhile(users, function(o) { return !o.active; });
|
* dropRightWhile(users, o => !o.active);
|
||||||
* // => objects for ['barney']
|
* // => objects for ['barney']
|
||||||
*/
|
*/
|
||||||
function dropRightWhile(array, predicate) {
|
function dropRightWhile(array, predicate) {
|
||||||
|
|||||||
@@ -12,13 +12,13 @@ import baseWhile from './.internal/baseWhile.js';
|
|||||||
* @returns {Array} Returns the slice of `array`.
|
* @returns {Array} Returns the slice of `array`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var users = [
|
* const users = [
|
||||||
* { 'user': 'barney', 'active': false },
|
* { 'user': 'barney', 'active': false },
|
||||||
* { 'user': 'fred', 'active': false },
|
* { 'user': 'fred', 'active': false },
|
||||||
* { 'user': 'pebbles', 'active': true }
|
* { 'user': 'pebbles', 'active': true }
|
||||||
* ];
|
* ];
|
||||||
*
|
*
|
||||||
* dropWhile(users, function(o) { return !o.active; });
|
* dropWhile(users, o => !o.active);
|
||||||
* // => objects for ['pebbles']
|
* // => objects for ['pebbles']
|
||||||
*/
|
*/
|
||||||
function dropWhile(array, predicate) {
|
function dropWhile(array, predicate) {
|
||||||
|
|||||||
4
eq.js
4
eq.js
@@ -10,8 +10,8 @@
|
|||||||
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var object = { 'a': 1 };
|
* const object = { 'a': 1 };
|
||||||
* var other = { 'a': 1 };
|
* const other = { 'a': 1 };
|
||||||
*
|
*
|
||||||
* eq(object, object);
|
* eq(object, object);
|
||||||
* // => true
|
* // => true
|
||||||
|
|||||||
2
fill.js
2
fill.js
@@ -16,7 +16,7 @@ import isIterateeCall from './.internal/isIterateeCall.js';
|
|||||||
* @returns {Array} Returns `array`.
|
* @returns {Array} Returns `array`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var array = [1, 2, 3];
|
* const array = [1, 2, 3];
|
||||||
*
|
*
|
||||||
* fill(array, 'a');
|
* fill(array, 'a');
|
||||||
* console.log(array);
|
* console.log(array);
|
||||||
|
|||||||
@@ -16,12 +16,12 @@ import baseFilter from './.internal/baseFilter.js';
|
|||||||
* @see reject
|
* @see reject
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var users = [
|
* const users = [
|
||||||
* { 'user': 'barney', 'age': 36, 'active': true },
|
* { 'user': 'barney', 'age': 36, 'active': true },
|
||||||
* { 'user': 'fred', 'age': 40, 'active': false }
|
* { 'user': 'fred', 'age': 40, 'active': false }
|
||||||
* ];
|
* ];
|
||||||
*
|
*
|
||||||
* filter(users, function(o) { return !o.active; });
|
* filter(users, o => !o.active);
|
||||||
* // => objects for ['fred']
|
* // => objects for ['fred']
|
||||||
*/
|
*/
|
||||||
function filter(collection, predicate) {
|
function filter(collection, predicate) {
|
||||||
|
|||||||
4
find.js
4
find.js
@@ -14,13 +14,13 @@ import findIndex from './findIndex.js';
|
|||||||
* @returns {*} Returns the matched element, else `undefined`.
|
* @returns {*} Returns the matched element, else `undefined`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var users = [
|
* const users = [
|
||||||
* { 'user': 'barney', 'age': 36, 'active': true },
|
* { 'user': 'barney', 'age': 36, 'active': true },
|
||||||
* { 'user': 'fred', 'age': 40, 'active': false },
|
* { 'user': 'fred', 'age': 40, 'active': false },
|
||||||
* { 'user': 'pebbles', 'age': 1, 'active': true }
|
* { 'user': 'pebbles', 'age': 1, 'active': true }
|
||||||
* ];
|
* ];
|
||||||
*
|
*
|
||||||
* find(users, function(o) { return o.age < 40; });
|
* find(users, o => o.age < 40);
|
||||||
* // => object for 'barney'
|
* // => object for 'barney'
|
||||||
*/
|
*/
|
||||||
const find = createFind(findIndex);
|
const find = createFind(findIndex);
|
||||||
|
|||||||
@@ -16,13 +16,13 @@ const nativeMax = Math.max;
|
|||||||
* @returns {number} Returns the index of the found element, else `-1`.
|
* @returns {number} Returns the index of the found element, else `-1`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var users = [
|
* const users = [
|
||||||
* { 'user': 'barney', 'active': false },
|
* { 'user': 'barney', 'active': false },
|
||||||
* { 'user': 'fred', 'active': false },
|
* { 'user': 'fred', 'active': false },
|
||||||
* { 'user': 'pebbles', 'active': true }
|
* { 'user': 'pebbles', 'active': true }
|
||||||
* ];
|
* ];
|
||||||
*
|
*
|
||||||
* findIndex(users, function(o) { return o.user == 'barney'; });
|
* findIndex(users, o => o.user == 'barney');
|
||||||
* // => 0
|
* // => 0
|
||||||
*/
|
*/
|
||||||
function findIndex(array, predicate, fromIndex) {
|
function findIndex(array, predicate, fromIndex) {
|
||||||
|
|||||||
@@ -13,13 +13,13 @@ import baseForOwn from './.internal/baseForOwn.js';
|
|||||||
* else `undefined`.
|
* else `undefined`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var users = {
|
* const users = {
|
||||||
* 'barney': { 'age': 36, 'active': true },
|
* 'barney': { 'age': 36, 'active': true },
|
||||||
* 'fred': { 'age': 40, 'active': false },
|
* 'fred': { 'age': 40, 'active': false },
|
||||||
* 'pebbles': { 'age': 1, 'active': true }
|
* 'pebbles': { 'age': 1, 'active': true }
|
||||||
* };
|
* };
|
||||||
*
|
*
|
||||||
* findKey(users, function(o) { return o.age < 40; });
|
* findKey(users, o => o.age < 40);
|
||||||
* // => 'barney' (iteration order is not guaranteed)
|
* // => 'barney' (iteration order is not guaranteed)
|
||||||
*/
|
*/
|
||||||
function findKey(object, predicate) {
|
function findKey(object, predicate) {
|
||||||
|
|||||||
@@ -13,9 +13,7 @@ import findLastIndex from './findLastIndex.js';
|
|||||||
* @returns {*} Returns the matched element, else `undefined`.
|
* @returns {*} Returns the matched element, else `undefined`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* findLast([1, 2, 3, 4], function(n) {
|
* findLast([1, 2, 3, 4], n => n % 2 == 1);
|
||||||
* return n % 2 == 1;
|
|
||||||
* });
|
|
||||||
* // => 3
|
* // => 3
|
||||||
*/
|
*/
|
||||||
const findLast = createFind(findLastIndex);
|
const findLast = createFind(findLastIndex);
|
||||||
|
|||||||
@@ -17,13 +17,13 @@ const nativeMin = Math.min;
|
|||||||
* @returns {number} Returns the index of the found element, else `-1`.
|
* @returns {number} Returns the index of the found element, else `-1`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var users = [
|
* const users = [
|
||||||
* { 'user': 'barney', 'active': true },
|
* { 'user': 'barney', 'active': true },
|
||||||
* { 'user': 'fred', 'active': false },
|
* { 'user': 'fred', 'active': false },
|
||||||
* { 'user': 'pebbles', 'active': false }
|
* { 'user': 'pebbles', 'active': false }
|
||||||
* ];
|
* ];
|
||||||
*
|
*
|
||||||
* findLastIndex(users, function(o) { return o.user == 'pebbles'; });
|
* findLastIndex(users, o => o.user == 'pebbles');
|
||||||
* // => 2
|
* // => 2
|
||||||
*/
|
*/
|
||||||
function findLastIndex(array, predicate, fromIndex) {
|
function findLastIndex(array, predicate, fromIndex) {
|
||||||
|
|||||||
@@ -13,13 +13,13 @@ import baseForOwnRight from './.internal/baseForOwnRight.js';
|
|||||||
* else `undefined`.
|
* else `undefined`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var users = {
|
* const users = {
|
||||||
* 'barney': { 'age': 36, 'active': true },
|
* 'barney': { 'age': 36, 'active': true },
|
||||||
* 'fred': { 'age': 40, 'active': false },
|
* 'fred': { 'age': 40, 'active': false },
|
||||||
* 'pebbles': { 'age': 1, 'active': true }
|
* 'pebbles': { 'age': 1, 'active': true }
|
||||||
* };
|
* };
|
||||||
*
|
*
|
||||||
* findLastKey(users, function(o) { return o.age < 40; });
|
* findLastKey(users, o => o.age < 40);
|
||||||
* // => returns 'pebbles' assuming `findKey` returns 'barney'
|
* // => returns 'pebbles' assuming `findKey` returns 'barney'
|
||||||
*/
|
*/
|
||||||
function findLastKey(object, predicate) {
|
function findLastKey(object, predicate) {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import toInteger from './toInteger.js';
|
|||||||
* @returns {Array} Returns the new flattened array.
|
* @returns {Array} Returns the new flattened array.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var array = [1, [2, [3, [4]], 5]];
|
* const array = [1, [2, [3, [4]], 5]];
|
||||||
*
|
*
|
||||||
* flattenDepth(array, 1);
|
* flattenDepth(array, 1);
|
||||||
* // => [1, 2, [3, [4]], 5]
|
* // => [1, 2, [3, [4]], 5]
|
||||||
|
|||||||
4
flip.js
4
flip.js
@@ -12,9 +12,7 @@ const WRAP_FLIP_FLAG = 512;
|
|||||||
* @returns {Function} Returns the new flipped function.
|
* @returns {Function} Returns the new flipped function.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var flipped = flip(function() {
|
* const flipped = flip((...args) => args);
|
||||||
* return toArray(arguments);
|
|
||||||
* });
|
|
||||||
*
|
*
|
||||||
* flipped('a', 'b', 'c', 'd');
|
* flipped('a', 'b', 'c', 'd');
|
||||||
* // => ['d', 'c', 'b', 'a']
|
* // => ['d', 'c', 'b', 'a']
|
||||||
|
|||||||
2
flow.js
2
flow.js
@@ -16,7 +16,7 @@ import createFlow from './.internal/createFlow.js';
|
|||||||
* return n * n;
|
* return n * n;
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* var addSquare = flow([add, square]);
|
* const addSquare = flow([add, square]);
|
||||||
* addSquare(1, 2);
|
* addSquare(1, 2);
|
||||||
* // => 9
|
* // => 9
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import createFlow from './.internal/createFlow.js';
|
|||||||
* return n * n;
|
* return n * n;
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* var addSquare = flowRight([square, add]);
|
* const addSquare = flowRight([square, add]);
|
||||||
* addSquare(1, 2);
|
* addSquare(1, 2);
|
||||||
* // => 9
|
* // => 9
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -19,14 +19,10 @@ import baseEach from './.internal/baseEach.js';;
|
|||||||
* @see forEachRight
|
* @see forEachRight
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* forEach([1, 2], function(value) {
|
* forEach([1, 2], value => console.log(value));
|
||||||
* console.log(value);
|
|
||||||
* });
|
|
||||||
* // => Logs `1` then `2`.
|
* // => Logs `1` then `2`.
|
||||||
*
|
*
|
||||||
* forEach({ 'a': 1, 'b': 2 }, function(value, key) {
|
* forEach({ 'a': 1, 'b': 2 }, (value, key) => console.log(key));
|
||||||
* console.log(key);
|
|
||||||
* });
|
|
||||||
* // => Logs 'a' then 'b' (iteration order is not guaranteed).
|
* // => Logs 'a' then 'b' (iteration order is not guaranteed).
|
||||||
*/
|
*/
|
||||||
function forEach(collection, iteratee) {
|
function forEach(collection, iteratee) {
|
||||||
|
|||||||
@@ -14,9 +14,7 @@ import baseEachRight from './.internal/baseEachRight.js';
|
|||||||
* @see forEach
|
* @see forEach
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* forEachRight([1, 2], function(value) {
|
* forEachRight([1, 2], value => console.log(value));
|
||||||
* console.log(value);
|
|
||||||
* });
|
|
||||||
* // => Logs `2` then `1`.
|
* // => Logs `2` then `1`.
|
||||||
*/
|
*/
|
||||||
function forEachRight(collection, iteratee) {
|
function forEachRight(collection, iteratee) {
|
||||||
|
|||||||
2
get.js
2
get.js
@@ -12,7 +12,7 @@ import baseGet from './.internal/baseGet.js';
|
|||||||
* @returns {*} Returns the resolved value.
|
* @returns {*} Returns the resolved value.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var object = { 'a': [{ 'b': { 'c': 3 } }] };
|
* const object = { 'a': [{ 'b': { 'c': 3 } }] };
|
||||||
*
|
*
|
||||||
* get(object, 'a[0].b.c');
|
* get(object, 'a[0].b.c');
|
||||||
* // => 3
|
* // => 3
|
||||||
|
|||||||
4
has.js
4
has.js
@@ -11,8 +11,8 @@ import hasPath from './.internal/hasPath.js';
|
|||||||
* @returns {boolean} Returns `true` if `path` exists, else `false`.
|
* @returns {boolean} Returns `true` if `path` exists, else `false`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var object = { 'a': { 'b': 2 } };
|
* const object = { 'a': { 'b': 2 } };
|
||||||
* var other = create({ 'a': create({ 'b': 2 }) });
|
* const other = create({ 'a': create({ 'b': 2 }) });
|
||||||
*
|
*
|
||||||
* has(object, 'a');
|
* has(object, 'a');
|
||||||
* // => true
|
* // => true
|
||||||
|
|||||||
2
hasIn.js
2
hasIn.js
@@ -11,7 +11,7 @@ import hasPath from './.internal/hasPath.js';
|
|||||||
* @returns {boolean} Returns `true` if `path` exists, else `false`.
|
* @returns {boolean} Returns `true` if `path` exists, else `false`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var object = create({ 'a': create({ 'b': 2 }) });
|
* const object = create({ 'a': create({ 'b': 2 }) });
|
||||||
*
|
*
|
||||||
* hasIn(object, 'a');
|
* hasIn(object, 'a');
|
||||||
* // => true
|
* // => true
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
* @returns {*} Returns `value`.
|
* @returns {*} Returns `value`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var object = { 'a': 1 };
|
* const object = { 'a': 1 };
|
||||||
*
|
*
|
||||||
* console.log(identity(object) === object);
|
* console.log(identity(object) === object);
|
||||||
* // => true
|
* // => true
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ import last from './last.js';
|
|||||||
* @returns {Array} Returns the new array of intersecting values.
|
* @returns {Array} Returns the new array of intersecting values.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
|
* const objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
|
||||||
* var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
|
* const others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
|
||||||
*
|
*
|
||||||
* intersectionWith(objects, others, isEqual);
|
* intersectionWith(objects, others, isEqual);
|
||||||
* // => [{ 'x': 1, 'y': 2 }]
|
* // => [{ 'x': 1, 'y': 2 }]
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import identity from './identity.js';
|
|||||||
* @returns {Object} Returns the new inverted object.
|
* @returns {Object} Returns the new inverted object.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var object = { 'a': 1, 'b': 2, 'c': 1 };
|
* const object = { 'a': 1, 'b': 2, 'c': 1 };
|
||||||
*
|
*
|
||||||
* invert(object);
|
* invert(object);
|
||||||
* // => { '1': 'c', '2': 'b' }
|
* // => { '1': 'c', '2': 'b' }
|
||||||
|
|||||||
@@ -17,11 +17,9 @@ const hasOwnProperty = Object.prototype.hasOwnProperty;
|
|||||||
* @returns {Object} Returns the new inverted object.
|
* @returns {Object} Returns the new inverted object.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var object = { 'a': 1, 'b': 2, 'c': 1 };
|
* const object = { 'a': 1, 'b': 2, 'c': 1 };
|
||||||
*
|
*
|
||||||
* invertBy(object, function(value) {
|
* invertBy(object, value => `group${ value }`);
|
||||||
* return 'group' + value;
|
|
||||||
* });
|
|
||||||
* // => { 'group1': ['a', 'c'], 'group2': ['b'] }
|
* // => { 'group1': ['a', 'c'], 'group2': ['b'] }
|
||||||
*/
|
*/
|
||||||
const invertBy = createInverter((result, value, key) => {
|
const invertBy = createInverter((result, value, key) => {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import baseInvoke from './.internal/baseInvoke.js';
|
|||||||
* @returns {*} Returns the result of the invoked method.
|
* @returns {*} Returns the result of the invoked method.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
|
* const object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
|
||||||
*
|
*
|
||||||
* invoke(object, 'a[0].b.c.slice', 1, 3);
|
* invoke(object, 'a[0].b.c.slice', 1, 3);
|
||||||
* // => [2, 3]
|
* // => [2, 3]
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ import baseIsEqual from './.internal/baseIsEqual.js';
|
|||||||
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var object = { 'a': 1 };
|
* const object = { 'a': 1 };
|
||||||
* var other = { 'a': 1 };
|
* const other = { 'a': 1 };
|
||||||
*
|
*
|
||||||
* isEqual(object, other);
|
* isEqual(object, other);
|
||||||
* // => true
|
* // => true
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ import baseIsEqual from './.internal/baseIsEqual.js';
|
|||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* var array = ['hello', 'goodbye'];
|
* const array = ['hello', 'goodbye'];
|
||||||
* var other = ['hi', 'goodbye'];
|
* const other = ['hi', 'goodbye'];
|
||||||
*
|
*
|
||||||
* isEqualWith(array, other, customizer);
|
* isEqualWith(array, other, customizer);
|
||||||
* // => true
|
* // => true
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import getMatchData from './.internal/getMatchData.js';
|
|||||||
* @returns {boolean} Returns `true` if `object` is a match, else `false`.
|
* @returns {boolean} Returns `true` if `object` is a match, else `false`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var object = { 'a': 1, 'b': 2 };
|
* const object = { 'a': 1, 'b': 2 };
|
||||||
*
|
*
|
||||||
* isMatch(object, { 'b': 2 });
|
* isMatch(object, { 'b': 2 });
|
||||||
* // => true
|
* // => true
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ import getMatchData from './.internal/getMatchData.js';
|
|||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* var object = { 'greeting': 'hello' };
|
* const object = { 'greeting': 'hello' };
|
||||||
* var source = { 'greeting': 'hi' };
|
* const source = { 'greeting': 'hi' };
|
||||||
*
|
*
|
||||||
* isMatchWith(object, source, customizer);
|
* isMatchWith(object, source, customizer);
|
||||||
* // => true
|
* // => true
|
||||||
|
|||||||
2
keyBy.js
2
keyBy.js
@@ -14,7 +14,7 @@ import createAggregator from './.internal/createAggregator.js';
|
|||||||
* @returns {Object} Returns the composed aggregate object.
|
* @returns {Object} Returns the composed aggregate object.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var array = [
|
* const array = [
|
||||||
* { 'dir': 'left', 'code': 97 },
|
* { 'dir': 'left', 'code': 97 },
|
||||||
* { 'dir': 'right', 'code': 100 }
|
* { 'dir': 'right', 'code': 100 }
|
||||||
* ];
|
* ];
|
||||||
|
|||||||
@@ -15,12 +15,12 @@ import baseForOwn from './.internal/baseForOwn.js';
|
|||||||
* @see mapKeys
|
* @see mapKeys
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var users = {
|
* const users = {
|
||||||
* 'fred': { 'user': 'fred', 'age': 40 },
|
* 'fred': { 'user': 'fred', 'age': 40 },
|
||||||
* 'pebbles': { 'user': 'pebbles', 'age': 1 }
|
* 'pebbles': { 'user': 'pebbles', 'age': 1 }
|
||||||
* };
|
* };
|
||||||
*
|
*
|
||||||
* mapValues(users, function(o) { return o.age; });
|
* mapValues(users, o => o.age);
|
||||||
* // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
|
* // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
|
||||||
*/
|
*/
|
||||||
function mapValues(object, iteratee) {
|
function mapValues(object, iteratee) {
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ const CLONE_DEEP_FLAG = 1;
|
|||||||
* @returns {Function} Returns the new spec function.
|
* @returns {Function} Returns the new spec function.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var objects = [
|
* const objects = [
|
||||||
* { 'a': 1, 'b': 2, 'c': 3 },
|
* { 'a': 1, 'b': 2, 'c': 3 },
|
||||||
* { 'a': 4, 'b': 5, 'c': 6 }
|
* { 'a': 4, 'b': 5, 'c': 6 }
|
||||||
* ];
|
* ];
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ const CLONE_DEEP_FLAG = 1;
|
|||||||
* @returns {Function} Returns the new spec function.
|
* @returns {Function} Returns the new spec function.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var objects = [
|
* const objects = [
|
||||||
* { 'a': 1, 'b': 2, 'c': 3 },
|
* { 'a': 1, 'b': 2, 'c': 3 },
|
||||||
* { 'a': 4, 'b': 5, 'c': 6 }
|
* { 'a': 4, 'b': 5, 'c': 6 }
|
||||||
* ];
|
* ];
|
||||||
|
|||||||
4
maxBy.js
4
maxBy.js
@@ -13,9 +13,9 @@ import baseGt from './.internal/baseGt.js';
|
|||||||
* @returns {*} Returns the maximum value.
|
* @returns {*} Returns the maximum value.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var objects = [{ 'n': 1 }, { 'n': 2 }];
|
* const objects = [{ 'n': 1 }, { 'n': 2 }];
|
||||||
*
|
*
|
||||||
* maxBy(objects, function(o) { return o.n; });
|
* maxBy(objects, o => o.n);
|
||||||
* // => { 'n': 2 }
|
* // => { 'n': 2 }
|
||||||
*/
|
*/
|
||||||
function maxBy(array, iteratee) {
|
function maxBy(array, iteratee) {
|
||||||
|
|||||||
@@ -15,9 +15,9 @@ const NAN = 0 / 0;
|
|||||||
* @returns {number} Returns the mean.
|
* @returns {number} Returns the mean.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
|
* const objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
|
||||||
*
|
*
|
||||||
* meanBy(objects, function(o) { return o.n; });
|
* meanBy(objects, o => o.n);
|
||||||
* // => 5
|
* // => 5
|
||||||
*/
|
*/
|
||||||
function meanBy(array, iteratee) {
|
function meanBy(array, iteratee) {
|
||||||
|
|||||||
@@ -20,10 +20,10 @@ import MapCache from './.internal/MapCache.js';
|
|||||||
* @returns {Function} Returns the new memoized function.
|
* @returns {Function} Returns the new memoized function.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var object = { 'a': 1, 'b': 2 };
|
* const object = { 'a': 1, 'b': 2 };
|
||||||
* var other = { 'c': 3, 'd': 4 };
|
* const other = { 'c': 3, 'd': 4 };
|
||||||
*
|
*
|
||||||
* var values = memoize(values);
|
* const values = memoize(values);
|
||||||
* values(object);
|
* values(object);
|
||||||
* // => [1, 2]
|
* // => [1, 2]
|
||||||
*
|
*
|
||||||
|
|||||||
4
merge.js
4
merge.js
@@ -19,11 +19,11 @@ import createAssigner from './.internal/createAssigner.js';
|
|||||||
* @returns {Object} Returns `object`.
|
* @returns {Object} Returns `object`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var object = {
|
* const object = {
|
||||||
* 'a': [{ 'b': 2 }, { 'd': 4 }]
|
* 'a': [{ 'b': 2 }, { 'd': 4 }]
|
||||||
* };
|
* };
|
||||||
*
|
*
|
||||||
* var other = {
|
* const other = {
|
||||||
* 'a': [{ 'c': 3 }, { 'e': 5 }]
|
* 'a': [{ 'c': 3 }, { 'e': 5 }]
|
||||||
* };
|
* };
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ import createAssigner from './.internal/createAssigner.js';
|
|||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* var object = { 'a': [1], 'b': [2] };
|
* const object = { 'a': [1], 'b': [2] };
|
||||||
* var other = { 'a': [3], 'b': [4] };
|
* const other = { 'a': [3], 'b': [4] };
|
||||||
*
|
*
|
||||||
* mergeWith(object, other, customizer);
|
* mergeWith(object, other, customizer);
|
||||||
* // => { 'a': [1, 3], 'b': [2, 4] }
|
* // => { 'a': [1, 3], 'b': [2, 4] }
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import baseInvoke from './.internal/baseInvoke.js';
|
|||||||
* @returns {Function} Returns the new invoker function.
|
* @returns {Function} Returns the new invoker function.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var objects = [
|
* const objects = [
|
||||||
* { 'a': { 'b': constant(2) } },
|
* { 'a': { 'b': constant(2) } },
|
||||||
* { 'a': { 'b': constant(1) } }
|
* { 'a': { 'b': constant(1) } }
|
||||||
* ];
|
* ];
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ import baseInvoke from './.internal/baseInvoke.js';
|
|||||||
* @returns {Function} Returns the new invoker function.
|
* @returns {Function} Returns the new invoker function.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var array = times(3, constant),
|
* const array = times(3, constant);
|
||||||
* object = { 'a': array, 'b': array, 'c': array };
|
* const object = { 'a': array, 'b': array, 'c': array };
|
||||||
*
|
*
|
||||||
* map(['a[2]', 'c[0]'], methodOf(object));
|
* map(['a[2]', 'c[0]'], methodOf(object));
|
||||||
* // => [2, 0]
|
* // => [2, 0]
|
||||||
|
|||||||
4
minBy.js
4
minBy.js
@@ -13,9 +13,9 @@ import baseLt from './.internal/baseLt.js';
|
|||||||
* @returns {*} Returns the minimum value.
|
* @returns {*} Returns the minimum value.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var objects = [{ 'n': 1 }, { 'n': 2 }];
|
* const objects = [{ 'n': 1 }, { 'n': 2 }];
|
||||||
*
|
*
|
||||||
* minBy(objects, function(o) { return o.n; });
|
* minBy(objects, o => o.n);
|
||||||
* // => { 'n': 1 }
|
* // => { 'n': 1 }
|
||||||
*/
|
*/
|
||||||
function minBy(array, iteratee) {
|
function minBy(array, iteratee) {
|
||||||
|
|||||||
2
nth.js
2
nth.js
@@ -12,7 +12,7 @@ import toInteger from './toInteger.js';
|
|||||||
* @returns {*} Returns the nth element of `array`.
|
* @returns {*} Returns the nth element of `array`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var array = ['a', 'b', 'c', 'd'];
|
* const array = ['a', 'b', 'c', 'd'];
|
||||||
*
|
*
|
||||||
* nth(array, 1);
|
* nth(array, 1);
|
||||||
* // => 'b'
|
* // => 'b'
|
||||||
|
|||||||
@@ -11,11 +11,11 @@ import toInteger from './toInteger.js';
|
|||||||
* @returns {Function} Returns the new pass-thru function.
|
* @returns {Function} Returns the new pass-thru function.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var func = nthArg(1);
|
* const func = nthArg(1);
|
||||||
* func('a', 'b', 'c', 'd');
|
* func('a', 'b', 'c', 'd');
|
||||||
* // => 'b'
|
* // => 'b'
|
||||||
*
|
*
|
||||||
* var func = nthArg(-2);
|
* const func = nthArg(-2);
|
||||||
* func('a', 'b', 'c', 'd');
|
* func('a', 'b', 'c', 'd');
|
||||||
* // => 'c'
|
* // => 'c'
|
||||||
*/
|
*/
|
||||||
|
|||||||
2
once.js
2
once.js
@@ -11,7 +11,7 @@ import before from './before.js';
|
|||||||
* @returns {Function} Returns the new restricted function.
|
* @returns {Function} Returns the new restricted function.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var initialize = once(createApplication);
|
* const initialize = once(createApplication);
|
||||||
* initialize();
|
* initialize();
|
||||||
* initialize();
|
* initialize();
|
||||||
* // => `createApplication` is invoked once
|
* // => `createApplication` is invoked once
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import baseOrderBy from './.internal/baseOrderBy.js';
|
|||||||
* @returns {Array} Returns the new sorted array.
|
* @returns {Array} Returns the new sorted array.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var users = [
|
* const users = [
|
||||||
* { 'user': 'fred', 'age': 48 },
|
* { 'user': 'fred', 'age': 48 },
|
||||||
* { 'user': 'barney', 'age': 34 },
|
* { 'user': 'barney', 'age': 34 },
|
||||||
* { 'user': 'fred', 'age': 40 },
|
* { 'user': 'fred', 'age': 40 },
|
||||||
|
|||||||
2
over.js
2
over.js
@@ -12,7 +12,7 @@ import createOver from './.internal/createOver.js';
|
|||||||
* @returns {Function} Returns the new function.
|
* @returns {Function} Returns the new function.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var func = over([Math.max, Math.min]);
|
* const func = over([Math.max, Math.min]);
|
||||||
*
|
*
|
||||||
* func(1, 2, 3, 4);
|
* func(1, 2, 3, 4);
|
||||||
* // => [4, 1]
|
* // => [4, 1]
|
||||||
|
|||||||
@@ -23,9 +23,7 @@ const nativeMin = Math.min;
|
|||||||
* return n * n;
|
* return n * n;
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* var func = overArgs(function(x, y) {
|
* const func = overArgs((x, y) => [x, y], [square, doubled]);
|
||||||
* return [x, y];
|
|
||||||
* }, [square, doubled]);
|
|
||||||
*
|
*
|
||||||
* func(9, 3);
|
* func(9, 3);
|
||||||
* // => [81, 6]
|
* // => [81, 6]
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import createOver from './.internal/createOver.js';
|
|||||||
* @returns {Function} Returns the new function.
|
* @returns {Function} Returns the new function.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var func = overEvery([Boolean, isFinite]);
|
* const func = overEvery([Boolean, isFinite]);
|
||||||
*
|
*
|
||||||
* func('1');
|
* func('1');
|
||||||
* // => true
|
* // => true
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import createOver from './.internal/createOver.js';
|
|||||||
* @returns {Function} Returns the new function.
|
* @returns {Function} Returns the new function.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var func = overSome([Boolean, isFinite]);
|
* const func = overSome([Boolean, isFinite]);
|
||||||
*
|
*
|
||||||
* func('1');
|
* func('1');
|
||||||
* // => true
|
* // => true
|
||||||
|
|||||||
@@ -13,13 +13,13 @@ import createAggregator from './.internal/createAggregator.js';
|
|||||||
* @returns {Array} Returns the array of grouped elements.
|
* @returns {Array} Returns the array of grouped elements.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var users = [
|
* const users = [
|
||||||
* { 'user': 'barney', 'age': 36, 'active': false },
|
* { 'user': 'barney', 'age': 36, 'active': false },
|
||||||
* { 'user': 'fred', 'age': 40, 'active': true },
|
* { 'user': 'fred', 'age': 40, 'active': true },
|
||||||
* { 'user': 'pebbles', 'age': 1, 'active': false }
|
* { 'user': 'pebbles', 'age': 1, 'active': false }
|
||||||
* ];
|
* ];
|
||||||
*
|
*
|
||||||
* partition(users, function(o) { return o.active; });
|
* partition(users, o => o.active);
|
||||||
* // => objects for [['fred'], ['barney', 'pebbles']]
|
* // => objects for [['fred'], ['barney', 'pebbles']]
|
||||||
*/
|
*/
|
||||||
const partition = createAggregator((result, value, key) =>
|
const partition = createAggregator((result, value, key) =>
|
||||||
|
|||||||
2
pick.js
2
pick.js
@@ -10,7 +10,7 @@ import basePick from './.internal/basePick.js';
|
|||||||
* @returns {Object} Returns the new object.
|
* @returns {Object} Returns the new object.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var object = { 'a': 1, 'b': '2', 'c': 3 };
|
* const object = { 'a': 1, 'b': '2', 'c': 3 };
|
||||||
*
|
*
|
||||||
* pick(object, ['a', 'c']);
|
* pick(object, ['a', 'c']);
|
||||||
* // => { 'a': 1, 'c': 3 }
|
* // => { 'a': 1, 'c': 3 }
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import getAllKeysIn from './.internal/getAllKeysIn.js';
|
|||||||
* @returns {Object} Returns the new object.
|
* @returns {Object} Returns the new object.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var object = { 'a': 1, 'b': '2', 'c': 3 };
|
* const object = { 'a': 1, 'b': '2', 'c': 3 };
|
||||||
*
|
*
|
||||||
* pickBy(object, isNumber);
|
* pickBy(object, isNumber);
|
||||||
* // => { 'a': 1, 'c': 3 }
|
* // => { 'a': 1, 'c': 3 }
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import toKey from './.internal/toKey.js';
|
|||||||
* @returns {Function} Returns the new accessor function.
|
* @returns {Function} Returns the new accessor function.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var objects = [
|
* const objects = [
|
||||||
* { 'a': { 'b': 2 } },
|
* { 'a': { 'b': 2 } },
|
||||||
* { 'a': { 'b': 1 } }
|
* { 'a': { 'b': 1 } }
|
||||||
* ];
|
* ];
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ import baseGet from './.internal/baseGet.js';
|
|||||||
* @returns {Function} Returns the new accessor function.
|
* @returns {Function} Returns the new accessor function.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var array = [0, 1, 2],
|
* const array = [0, 1, 2];
|
||||||
* object = { 'a': array, 'b': array, 'c': array };
|
* const object = { 'a': array, 'b': array, 'c': array };
|
||||||
*
|
*
|
||||||
* map(['a[2]', 'c[0]'], propertyOf(object));
|
* map(['a[2]', 'c[0]'], propertyOf(object));
|
||||||
* // => [2, 0]
|
* // => [2, 0]
|
||||||
|
|||||||
2
pull.js
2
pull.js
@@ -15,7 +15,7 @@ import pullAll from './pullAll.js';
|
|||||||
* @returns {Array} Returns `array`.
|
* @returns {Array} Returns `array`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var array = ['a', 'b', 'c', 'a', 'b', 'c'];
|
* const array = ['a', 'b', 'c', 'a', 'b', 'c'];
|
||||||
*
|
*
|
||||||
* pull(array, 'a', 'c');
|
* pull(array, 'a', 'c');
|
||||||
* console.log(array);
|
* console.log(array);
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import basePullAll from './.internal/basePullAll.js';
|
|||||||
* @returns {Array} Returns `array`.
|
* @returns {Array} Returns `array`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var array = ['a', 'b', 'c', 'a', 'b', 'c'];
|
* const array = ['a', 'b', 'c', 'a', 'b', 'c'];
|
||||||
*
|
*
|
||||||
* pullAll(array, ['a', 'c']);
|
* pullAll(array, ['a', 'c']);
|
||||||
* console.log(array);
|
* console.log(array);
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import basePullAll from './.internal/basePullAll.js';
|
|||||||
* @returns {Array} Returns `array`.
|
* @returns {Array} Returns `array`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
|
* const array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
|
||||||
*
|
*
|
||||||
* pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
|
* pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
|
||||||
* console.log(array);
|
* console.log(array);
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import basePullAll from './.internal/basePullAll.js';
|
|||||||
* @returns {Array} Returns `array`.
|
* @returns {Array} Returns `array`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
|
* const array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
|
||||||
*
|
*
|
||||||
* pullAllWith(array, [{ 'x': 3, 'y': 4 }], isEqual);
|
* pullAllWith(array, [{ 'x': 3, 'y': 4 }], isEqual);
|
||||||
* console.log(array);
|
* console.log(array);
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ import isIndex from './.internal/isIndex.js';
|
|||||||
* @returns {Array} Returns the new array of removed elements.
|
* @returns {Array} Returns the new array of removed elements.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var array = ['a', 'b', 'c', 'd'];
|
* const array = ['a', 'b', 'c', 'd'];
|
||||||
* var pulled = pullAt(array, [1, 3]);
|
* const pulled = pullAt(array, [1, 3]);
|
||||||
*
|
*
|
||||||
* console.log(array);
|
* console.log(array);
|
||||||
* // => ['a', 'c']
|
* // => ['a', 'c']
|
||||||
|
|||||||
6
rearg.js
6
rearg.js
@@ -16,11 +16,9 @@ const WRAP_REARG_FLAG = 256;
|
|||||||
* @returns {Function} Returns the new function.
|
* @returns {Function} Returns the new function.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var rearged = rearg(function(a, b, c) {
|
* const rearged = rearg((a, b, c) => [a, b, c], [2, 0, 1]);
|
||||||
* return [a, b, c];
|
|
||||||
* }, [2, 0, 1]);
|
|
||||||
*
|
*
|
||||||
* rearged('b', 'c', 'a')
|
* rearged('b', 'c', 'a');
|
||||||
* // => ['a', 'b', 'c']
|
* // => ['a', 'b', 'c']
|
||||||
*/
|
*/
|
||||||
function rearg(func, ...indexes) {
|
function rearg(func, ...indexes) {
|
||||||
|
|||||||
@@ -26,12 +26,10 @@ import baseReduce from './.internal/baseReduce.js';
|
|||||||
* @see reduceRight
|
* @see reduceRight
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* reduce([1, 2], function(sum, n) {
|
* reduce([1, 2], (sum, n) => sum + n, 0);
|
||||||
* return sum + n;
|
|
||||||
* }, 0);
|
|
||||||
* // => 3
|
* // => 3
|
||||||
*
|
*
|
||||||
* reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
|
* reduce({ 'a': 1, 'b': 2, 'c': 1 }, (result, value, key) => {
|
||||||
* (result[value] || (result[value] = [])).push(key);
|
* (result[value] || (result[value] = [])).push(key);
|
||||||
* return result;
|
* return result;
|
||||||
* }, {});
|
* }, {});
|
||||||
|
|||||||
@@ -15,11 +15,9 @@ import baseReduce from './.internal/baseReduce.js';
|
|||||||
* @see reduce
|
* @see reduce
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var array = [[0, 1], [2, 3], [4, 5]];
|
* const array = [[0, 1], [2, 3], [4, 5]];
|
||||||
*
|
*
|
||||||
* reduceRight(array, function(flattened, other) {
|
* reduceRight(array, (flattened, other) => flattened.concat(other), []);
|
||||||
* return flattened.concat(other);
|
|
||||||
* }, []);
|
|
||||||
* // => [4, 5, 2, 3, 0, 1]
|
* // => [4, 5, 2, 3, 0, 1]
|
||||||
*/
|
*/
|
||||||
function reduceRight(collection, iteratee, accumulator) {
|
function reduceRight(collection, iteratee, accumulator) {
|
||||||
|
|||||||
@@ -14,12 +14,12 @@ import negate from './negate.js';
|
|||||||
* @see filter
|
* @see filter
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var users = [
|
* const users = [
|
||||||
* { 'user': 'barney', 'age': 36, 'active': false },
|
* { 'user': 'barney', 'age': 36, 'active': false },
|
||||||
* { 'user': 'fred', 'age': 40, 'active': true }
|
* { 'user': 'fred', 'age': 40, 'active': true }
|
||||||
* ];
|
* ];
|
||||||
*
|
*
|
||||||
* reject(users, function(o) { return !o.active; });
|
* reject(users, o => !o.active);
|
||||||
* // => objects for ['fred']
|
* // => objects for ['fred']
|
||||||
*/
|
*/
|
||||||
function reject(collection, predicate) {
|
function reject(collection, predicate) {
|
||||||
|
|||||||
@@ -15,10 +15,8 @@ import basePullAt from './.internal/basePullAt.js';
|
|||||||
* @returns {Array} Returns the new array of removed elements.
|
* @returns {Array} Returns the new array of removed elements.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var array = [1, 2, 3, 4];
|
* const array = [1, 2, 3, 4];
|
||||||
* var evens = remove(array, function(n) {
|
* const evens = remove(array, n => n % 2 == 0);
|
||||||
* return n % 2 == 0;
|
|
||||||
* });
|
|
||||||
*
|
*
|
||||||
* console.log(array);
|
* console.log(array);
|
||||||
* // => [1, 3]
|
* // => [1, 3]
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import toKey from './.internal/toKey.js';
|
|||||||
* @returns {*} Returns the resolved value.
|
* @returns {*} Returns the resolved value.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var object = { 'a': [{ 'b': { 'c1': 3, 'c2': constant(4) } }] };
|
* const object = { 'a': [{ 'b': { 'c1': 3, 'c2': constant(4) } }] };
|
||||||
*
|
*
|
||||||
* result(object, 'a[0].b.c1');
|
* result(object, 'a[0].b.c1');
|
||||||
* // => 3
|
* // => 3
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ const nativeReverse = Array.prototype.reverse;
|
|||||||
* @returns {Array} Returns `array`.
|
* @returns {Array} Returns `array`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var array = [1, 2, 3];
|
* const array = [1, 2, 3];
|
||||||
*
|
*
|
||||||
* reverse(array);
|
* reverse(array);
|
||||||
* // => [3, 2, 1]
|
* // => [3, 2, 1]
|
||||||
|
|||||||
2
set.js
2
set.js
@@ -16,7 +16,7 @@ import baseSet from './.internal/baseSet.js';
|
|||||||
* @returns {Object} Returns `object`.
|
* @returns {Object} Returns `object`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var object = { 'a': [{ 'b': { 'c': 3 } }] };
|
* const object = { 'a': [{ 'b': { 'c': 3 } }] };
|
||||||
*
|
*
|
||||||
* set(object, 'a[0].b.c', 4);
|
* set(object, 'a[0].b.c', 4);
|
||||||
* console.log(object.a[0].b.c);
|
* console.log(object.a[0].b.c);
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import baseSet from './.internal/baseSet.js';
|
|||||||
* @returns {Object} Returns `object`.
|
* @returns {Object} Returns `object`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var object = {};
|
* const object = {};
|
||||||
*
|
*
|
||||||
* setWith(object, '[0][1]', 'a', Object);
|
* setWith(object, '[0][1]', 'a', Object);
|
||||||
* // => { '0': { '1': 'a' } }
|
* // => { '0': { '1': 'a' } }
|
||||||
|
|||||||
@@ -14,9 +14,9 @@ import baseSortedIndexBy from './.internal/baseSortedIndexBy.js';
|
|||||||
* into `array`.
|
* into `array`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var objects = [{ 'x': 4 }, { 'x': 5 }];
|
* const objects = [{ 'x': 4 }, { 'x': 5 }];
|
||||||
*
|
*
|
||||||
* sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
|
* sortedIndexBy(objects, { 'x': 4 }, o => o.x);
|
||||||
* // => 0
|
* // => 0
|
||||||
*/
|
*/
|
||||||
function sortedIndexBy(array, value, iteratee) {
|
function sortedIndexBy(array, value, iteratee) {
|
||||||
|
|||||||
@@ -14,9 +14,9 @@ import baseSortedIndexBy from './.internal/baseSortedIndexBy.js';
|
|||||||
* into `array`.
|
* into `array`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var objects = [{ 'x': 4 }, { 'x': 5 }];
|
* const objects = [{ 'x': 4 }, { 'x': 5 }];
|
||||||
*
|
*
|
||||||
* sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
|
* sortedLastIndexBy(objects, { 'x': 4 }, o => o.x);
|
||||||
* // => 1
|
* // => 1
|
||||||
*/
|
*/
|
||||||
function sortedLastIndexBy(array, value, iteratee) {
|
function sortedLastIndexBy(array, value, iteratee) {
|
||||||
|
|||||||
10
spread.js
10
spread.js
@@ -21,21 +21,17 @@ const nativeMax = Math.max;
|
|||||||
* @returns {Function} Returns the new function.
|
* @returns {Function} Returns the new function.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var say = spread(function(who, what) {
|
* const say = spread((who, what) => `${ who } says ${ what }`);
|
||||||
* return who + ' says ' + what;
|
|
||||||
* });
|
|
||||||
*
|
*
|
||||||
* say(['fred', 'hello']);
|
* say(['fred', 'hello']);
|
||||||
* // => 'fred says hello'
|
* // => 'fred says hello'
|
||||||
*
|
*
|
||||||
* var numbers = Promise.all([
|
* const numbers = Promise.all([
|
||||||
* Promise.resolve(40),
|
* Promise.resolve(40),
|
||||||
* Promise.resolve(36)
|
* Promise.resolve(36)
|
||||||
* ]);
|
* ]);
|
||||||
*
|
*
|
||||||
* numbers.then(spread(function(x, y) {
|
* numbers.then(spread((x, y) => x + y));
|
||||||
* return x + y;
|
|
||||||
* }));
|
|
||||||
* // => a Promise of 76
|
* // => a Promise of 76
|
||||||
*/
|
*/
|
||||||
function spread(func, start) {
|
function spread(func, start) {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
* @returns {Array} Returns the new empty array.
|
* @returns {Array} Returns the new empty array.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var arrays = times(2, stubArray);
|
* const arrays = times(2, stubArray);
|
||||||
*
|
*
|
||||||
* console.log(arrays);
|
* console.log(arrays);
|
||||||
* // => [[], []]
|
* // => [[], []]
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
* @returns {Object} Returns the new empty object.
|
* @returns {Object} Returns the new empty object.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var objects = times(2, stubObject);
|
* const objects = times(2, stubObject);
|
||||||
*
|
*
|
||||||
* console.log(objects);
|
* console.log(objects);
|
||||||
* // => [{}, {}]
|
* // => [{}, {}]
|
||||||
|
|||||||
4
sumBy.js
4
sumBy.js
@@ -12,9 +12,9 @@ import baseSum from './.internal/baseSum.js';
|
|||||||
* @returns {number} Returns the sum.
|
* @returns {number} Returns the sum.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
|
* const objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
|
||||||
*
|
*
|
||||||
* sumBy(objects, function(o) { return o.n; });
|
* sumBy(objects, o => o.n);
|
||||||
* // => 20
|
* // => 20
|
||||||
*/
|
*/
|
||||||
function sumBy(array, iteratee) {
|
function sumBy(array, iteratee) {
|
||||||
|
|||||||
@@ -12,13 +12,13 @@ import baseWhile from './.internal/baseWhile.js';
|
|||||||
* @returns {Array} Returns the slice of `array`.
|
* @returns {Array} Returns the slice of `array`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var users = [
|
* const users = [
|
||||||
* { 'user': 'barney', 'active': true },
|
* { 'user': 'barney', 'active': true },
|
||||||
* { 'user': 'fred', 'active': false },
|
* { 'user': 'fred', 'active': false },
|
||||||
* { 'user': 'pebbles', 'active': false }
|
* { 'user': 'pebbles', 'active': false }
|
||||||
* ];
|
* ];
|
||||||
*
|
*
|
||||||
* takeRightWhile(users, function(o) { return !o.active; });
|
* takeRightWhile(users, o => !o.active);
|
||||||
* // => objects for ['fred', 'pebbles']
|
* // => objects for ['fred', 'pebbles']
|
||||||
*/
|
*/
|
||||||
function takeRightWhile(array, predicate) {
|
function takeRightWhile(array, predicate) {
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user