From ef2c4bf5e1c93282ba34d016e6dc3f57f758dfbb Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Tue, 10 Jan 2017 01:45:20 -0800 Subject: [PATCH] Update doc examples to ES2015. --- after.js | 11 +++-------- assignInWith.js | 2 +- assignWith.js | 2 +- at.js | 2 +- attempt.js | 5 ++--- bind.js | 6 +++--- bindAll.js | 6 ++---- bindKey.js | 6 +++--- castArray.js | 2 +- clone.js | 4 ++-- cloneDeep.js | 4 ++-- cloneDeepWith.js | 2 +- cloneWith.js | 2 +- concat.js | 4 ++-- cond.js | 6 +++--- conforms.js | 2 +- conformsTo.js | 2 +- constant.js | 2 +- create.js | 2 +- curry.js | 4 ++-- curryRight.js | 4 ++-- debounce.js | 4 ++-- defer.js | 4 +--- delay.js | 4 +--- differenceWith.js | 2 +- dropRightWhile.js | 4 ++-- dropWhile.js | 4 ++-- eq.js | 4 ++-- fill.js | 2 +- filter.js | 4 ++-- find.js | 4 ++-- findIndex.js | 4 ++-- findKey.js | 4 ++-- findLast.js | 4 +--- findLastIndex.js | 4 ++-- findLastKey.js | 4 ++-- flattenDepth.js | 2 +- flip.js | 4 +--- flow.js | 2 +- flowRight.js | 2 +- forEach.js | 8 ++------ forEachRight.js | 4 +--- get.js | 2 +- has.js | 4 ++-- hasIn.js | 2 +- identity.js | 2 +- intersectionWith.js | 4 ++-- invert.js | 2 +- invertBy.js | 6 ++---- invoke.js | 2 +- isEqual.js | 4 ++-- isEqualWith.js | 4 ++-- isMatch.js | 2 +- isMatchWith.js | 4 ++-- keyBy.js | 2 +- mapValues.js | 4 ++-- matches.js | 2 +- matchesProperty.js | 2 +- maxBy.js | 4 ++-- meanBy.js | 4 ++-- memoize.js | 6 +++--- merge.js | 4 ++-- mergeWith.js | 4 ++-- method.js | 2 +- methodOf.js | 4 ++-- minBy.js | 4 ++-- nth.js | 2 +- nthArg.js | 4 ++-- once.js | 2 +- orderBy.js | 2 +- over.js | 2 +- overArgs.js | 4 +--- overEvery.js | 2 +- overSome.js | 2 +- partition.js | 4 ++-- pick.js | 2 +- pickBy.js | 2 +- property.js | 2 +- propertyOf.js | 4 ++-- pull.js | 2 +- pullAll.js | 2 +- pullAllBy.js | 2 +- pullAllWith.js | 2 +- pullAt.js | 4 ++-- rearg.js | 6 ++---- reduce.js | 6 ++---- reduceRight.js | 6 ++---- reject.js | 4 ++-- remove.js | 6 ++---- result.js | 2 +- reverse.js | 2 +- set.js | 2 +- setWith.js | 2 +- sortedIndexBy.js | 4 ++-- sortedLastIndexBy.js | 4 ++-- spread.js | 10 +++------- stubArray.js | 2 +- stubObject.js | 2 +- sumBy.js | 4 ++-- takeRightWhile.js | 4 ++-- takeWhile.js | 4 ++-- template.js | 28 ++++++++++++++-------------- throttle.js | 2 +- transform.js | 4 ++-- unionWith.js | 4 ++-- uniqWith.js | 2 +- unset.js | 2 +- unzip.js | 2 +- unzipWith.js | 2 +- update.js | 6 +++--- updateWith.js | 2 +- xorWith.js | 4 ++-- zipWith.js | 4 +--- 113 files changed, 188 insertions(+), 228 deletions(-) diff --git a/after.js b/after.js index b643ea762..681c6b814 100644 --- a/after.js +++ b/after.js @@ -11,15 +11,10 @@ import toInteger from './toInteger.js'; * @returns {Function} Returns the new restricted function. * @example * - * var saves = ['profile', 'settings']; + * const saves = ['profile', 'settings']; + * const done = after(saves.length, () => console.log('done saving!')); * - * var done = after(saves.length, function() { - * console.log('done saving!'); - * }); - * - * forEach(saves, function(type) { - * asyncSave({ 'type': type, 'complete': done }); - * }); + * forEach(saves, type => asyncSave({ 'type': type, 'complete': done })); * // => Logs 'done saving!' after the two async saves have completed. */ function after(n, func) { diff --git a/assignInWith.js b/assignInWith.js index 7983ee26f..7eca9a6af 100644 --- a/assignInWith.js +++ b/assignInWith.js @@ -24,7 +24,7 @@ import keysIn from './keysIn.js'; * return isUndefined(objValue) ? srcValue : objValue; * } * - * var defaults = partialRight(assignInWith, customizer); + * const defaults = partialRight(assignInWith, customizer); * * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); * // => { 'a': 1, 'b': 2 } diff --git a/assignWith.js b/assignWith.js index 9cd537f68..d4c797891 100644 --- a/assignWith.js +++ b/assignWith.js @@ -23,7 +23,7 @@ import keys from './keys.js'; * return isUndefined(objValue) ? srcValue : objValue; * } * - * var defaults = partialRight(assignWith, customizer); + * const defaults = partialRight(assignWith, customizer); * * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); * // => { 'a': 1, 'b': 2 } diff --git a/at.js b/at.js index 0031eea44..cbd2045aa 100644 --- a/at.js +++ b/at.js @@ -10,7 +10,7 @@ import baseAt from './.internal/baseAt.js'; * @returns {Array} Returns the picked values. * @example * - * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] }; + * const object = { 'a': [{ 'b': { 'c': 3 } }, 4] }; * * at(object, ['a[0].b.c', 'a[1]']); * // => [3, 4] diff --git a/attempt.js b/attempt.js index d759fc89f..97ac4e6fb 100644 --- a/attempt.js +++ b/attempt.js @@ -13,9 +13,8 @@ import isError from './isError.js'; * @example * * // Avoid throwing errors for invalid selectors. - * var elements = attempt(function(selector) { - * return document.querySelectorAll(selector); - * }, '>_>'); + * const elements = attempt(selector => + * document.querySelectorAll(selector), '>_>'); * * if (isError(elements)) { * elements = []; diff --git a/bind.js b/bind.js index 0df7b4329..9b29eeecb 100644 --- a/bind.js +++ b/bind.js @@ -28,14 +28,14 @@ const WRAP_PARTIAL_FLAG = 32; * 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('!'); * // => 'hi fred!' * * // Bound with placeholders. - * var bound = bind(greet, object, _, '!'); + * const bound = bind(greet, object, _, '!'); * bound('hi'); * // => 'hi fred!' */ diff --git a/bindAll.js b/bindAll.js index 58ce7aab3..bd7866db6 100644 --- a/bindAll.js +++ b/bindAll.js @@ -16,11 +16,9 @@ import toKey from './.internal/toKey.js'; * @returns {Object} Returns `object`. * @example * - * var view = { + * const view = { * 'label': 'docs', - * 'click': function() { - * console.log('clicked ' + this.label); - * } + * 'click': () => console.log(`clicked ${ this.label }`) * }; * * bindAll(view, ['click']); diff --git a/bindKey.js b/bindKey.js index 9b05d2686..fc666d97e 100644 --- a/bindKey.js +++ b/bindKey.js @@ -27,14 +27,14 @@ const WRAP_PARTIAL_FLAG = 32; * @returns {Function} Returns the new bound function. * @example * - * var object = { + * const object = { * 'user': 'fred', * 'greet': function(greeting, punctuation) { * return greeting + ' ' + this.user + punctuation; * } * }; * - * var bound = bindKey(object, 'greet', 'hi'); + * const bound = bindKey(object, 'greet', 'hi'); * bound('!'); * // => 'hi fred!' * @@ -46,7 +46,7 @@ const WRAP_PARTIAL_FLAG = 32; * // => 'hiya fred!' * * // Bound with placeholders. - * var bound = bindKey(object, 'greet', _, '!'); + * const bound = bindKey(object, 'greet', _, '!'); * bound('hi'); * // => 'hiya fred!' */ diff --git a/castArray.js b/castArray.js index d028eb44f..55d46412b 100644 --- a/castArray.js +++ b/castArray.js @@ -26,7 +26,7 @@ * castArray(); * // => [] * - * var array = [1, 2, 3]; + * const array = [1, 2, 3]; * console.log(castArray(array) === array); * // => true */ diff --git a/clone.js b/clone.js index 30f9ad573..16dac4de4 100644 --- a/clone.js +++ b/clone.js @@ -21,9 +21,9 @@ const CLONE_SYMBOLS_FLAG = 4; * @see cloneDeep * @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]); * // => true */ diff --git a/cloneDeep.js b/cloneDeep.js index cdf26282b..3f6a14247 100644 --- a/cloneDeep.js +++ b/cloneDeep.js @@ -14,9 +14,9 @@ const CLONE_SYMBOLS_FLAG = 4; * @see clone * @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]); * // => false */ diff --git a/cloneDeepWith.js b/cloneDeepWith.js index 75642f2b1..ba27e8a29 100644 --- a/cloneDeepWith.js +++ b/cloneDeepWith.js @@ -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); * // => false diff --git a/cloneWith.js b/cloneWith.js index 8bf382120..20a69203f 100644 --- a/cloneWith.js +++ b/cloneWith.js @@ -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); * // => false diff --git a/concat.js b/concat.js index 5817dbf7c..42b44f9a9 100644 --- a/concat.js +++ b/concat.js @@ -13,8 +13,8 @@ import copyArray from './.internal/copyArray.js'; * @returns {Array} Returns the new concatenated array. * @example * - * var array = [1]; - * var other = concat(array, 2, [3], [[4]]); + * const array = [1]; + * const other = concat(array, 2, [3], [[4]]); * * console.log(other); * // => [1, 2, 3, [4]] diff --git a/cond.js b/cond.js index e6e5f18f2..0ee04f896 100644 --- a/cond.js +++ b/cond.js @@ -13,10 +13,10 @@ import arrayMap from './.internal/arrayMap.js'; * @returns {Function} Returns the new composite function. * @example * - * var func = cond([ - * [matches({ 'a': 1 }), constant('matches A')], + * const func = cond([ + * [matches({ 'a': 1 }), constant('matches A')], * [conforms({ 'b': isNumber }), constant('matches B')], - * [stubTrue, constant('no match')] + * [stubTrue, constant('no match')] * ]); * * func({ 'a': 1, 'b': 2 }); diff --git a/conforms.js b/conforms.js index 2180f255f..8468a5c82 100644 --- a/conforms.js +++ b/conforms.js @@ -18,7 +18,7 @@ const CLONE_DEEP_FLAG = 1; * @returns {Function} Returns the new spec function. * @example * - * var objects = [ + * const objects = [ * { 'a': 2, 'b': 1 }, * { 'a': 1, 'b': 2 } * ]; diff --git a/conformsTo.js b/conformsTo.js index 8117230d4..286bd70b7 100644 --- a/conformsTo.js +++ b/conformsTo.js @@ -15,7 +15,7 @@ import keys from './keys.js'; * @returns {boolean} Returns `true` if `object` conforms, else `false`. * @example * - * var object = { 'a': 1, 'b': 2 }; + * const object = { 'a': 1, 'b': 2 }; * * conformsTo(object, { 'b': function(n) { return n > 1; } }); * // => true diff --git a/constant.js b/constant.js index 410760036..1e2e0d160 100644 --- a/constant.js +++ b/constant.js @@ -7,7 +7,7 @@ * @returns {Function} Returns the new constant function. * @example * - * var objects = times(2, constant({ 'a': 1 })); + * const objects = times(2, constant({ 'a': 1 })); * * console.log(objects); * // => [{ 'a': 1 }, { 'a': 1 }] diff --git a/create.js b/create.js index 8fa2213a1..5b6a49560 100644 --- a/create.js +++ b/create.js @@ -26,7 +26,7 @@ import baseCreate from './.internal/baseCreate.js'; * 'constructor': Circle * }); * - * var circle = new Circle; + * const circle = new Circle; * circle instanceof Circle; * // => true * diff --git a/curry.js b/curry.js index 5b1aaf65e..47d232a9a 100644 --- a/curry.js +++ b/curry.js @@ -23,11 +23,11 @@ const WRAP_CURRY_FLAG = 8; * @returns {Function} Returns the new curried function. * @example * - * var abc = function(a, b, c) { + * const abc = function(a, b, c) { * return [a, b, c]; * }; * - * var curried = curry(abc); + * const curried = curry(abc); * * curried(1)(2)(3); * // => [1, 2, 3] diff --git a/curryRight.js b/curryRight.js index dbaade834..5761f68f1 100644 --- a/curryRight.js +++ b/curryRight.js @@ -20,11 +20,11 @@ const WRAP_CURRY_RIGHT_FLAG = 16; * @returns {Function} Returns the new curried function. * @example * - * var abc = function(a, b, c) { + * const abc = function(a, b, c) { * return [a, b, c]; * }; * - * var curried = curryRight(abc); + * const curried = curryRight(abc); * * curried(3)(2)(1); * // => [1, 2, 3] diff --git a/debounce.js b/debounce.js index b54e6c69c..29dcad75f 100644 --- a/debounce.js +++ b/debounce.js @@ -50,8 +50,8 @@ const nativeMin = Math.min; * })); * * // Ensure `batchLog` is invoked once after 1 second of debounced calls. - * var debounced = debounce(batchLog, 250, { 'maxWait': 1000 }); - * var source = new EventSource('/stream'); + * const debounced = debounce(batchLog, 250, { 'maxWait': 1000 }); + * const source = new EventSource('/stream'); * jQuery(source).on('message', debounced); * * // Cancel the trailing debounced invocation. diff --git a/defer.js b/defer.js index ecb12f5e9..9cd24eb1e 100644 --- a/defer.js +++ b/defer.js @@ -11,9 +11,7 @@ import baseDelay from './.internal/baseDelay.js'; * @returns {number} Returns the timer id. * @example * - * defer(function(text) { - * console.log(text); - * }, 'deferred'); + * defer(text => console.log(text), 'deferred'); * // => Logs 'deferred' after one millisecond. */ function defer(func, ...args) { diff --git a/delay.js b/delay.js index 5b5877880..1b687aed7 100644 --- a/delay.js +++ b/delay.js @@ -13,9 +13,7 @@ import toNumber from './toNumber.js'; * @returns {number} Returns the timer id. * @example * - * delay(function(text) { - * console.log(text); - * }, 1000, 'later'); + * delay(text => console.log(text), 1000, 'later'); * // => Logs 'later' after one second. */ function delay(func, wait, ...args) { diff --git a/differenceWith.js b/differenceWith.js index aeb406d18..e14a78c7b 100644 --- a/differenceWith.js +++ b/differenceWith.js @@ -19,7 +19,7 @@ import last from './last.js'; * @returns {Array} Returns the new array of filtered values. * @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); * // => [{ 'x': 2, 'y': 1 }] diff --git a/dropRightWhile.js b/dropRightWhile.js index d312300a6..470cbd8fc 100644 --- a/dropRightWhile.js +++ b/dropRightWhile.js @@ -12,13 +12,13 @@ import baseWhile from './.internal/baseWhile.js'; * @returns {Array} Returns the slice of `array`. * @example * - * var users = [ + * const users = [ * { 'user': 'barney', 'active': true }, * { 'user': 'fred', 'active': false }, * { 'user': 'pebbles', 'active': false } * ]; * - * dropRightWhile(users, function(o) { return !o.active; }); + * dropRightWhile(users, o => !o.active); * // => objects for ['barney'] */ function dropRightWhile(array, predicate) { diff --git a/dropWhile.js b/dropWhile.js index f19393243..327f8fc06 100644 --- a/dropWhile.js +++ b/dropWhile.js @@ -12,13 +12,13 @@ import baseWhile from './.internal/baseWhile.js'; * @returns {Array} Returns the slice of `array`. * @example * - * var users = [ + * const users = [ * { 'user': 'barney', 'active': false }, * { 'user': 'fred', 'active': false }, * { 'user': 'pebbles', 'active': true } * ]; * - * dropWhile(users, function(o) { return !o.active; }); + * dropWhile(users, o => !o.active); * // => objects for ['pebbles'] */ function dropWhile(array, predicate) { diff --git a/eq.js b/eq.js index dac34b9a9..cb6d8abab 100644 --- a/eq.js +++ b/eq.js @@ -10,8 +10,8 @@ * @returns {boolean} Returns `true` if the values are equivalent, else `false`. * @example * - * var object = { 'a': 1 }; - * var other = { 'a': 1 }; + * const object = { 'a': 1 }; + * const other = { 'a': 1 }; * * eq(object, object); * // => true diff --git a/fill.js b/fill.js index 56c973073..014571ba0 100644 --- a/fill.js +++ b/fill.js @@ -16,7 +16,7 @@ import isIterateeCall from './.internal/isIterateeCall.js'; * @returns {Array} Returns `array`. * @example * - * var array = [1, 2, 3]; + * const array = [1, 2, 3]; * * fill(array, 'a'); * console.log(array); diff --git a/filter.js b/filter.js index d2e462996..9ea892e8f 100644 --- a/filter.js +++ b/filter.js @@ -16,12 +16,12 @@ import baseFilter from './.internal/baseFilter.js'; * @see reject * @example * - * var users = [ + * const users = [ * { 'user': 'barney', 'age': 36, 'active': true }, * { 'user': 'fred', 'age': 40, 'active': false } * ]; * - * filter(users, function(o) { return !o.active; }); + * filter(users, o => !o.active); * // => objects for ['fred'] */ function filter(collection, predicate) { diff --git a/find.js b/find.js index 502db3554..8b406fe27 100644 --- a/find.js +++ b/find.js @@ -14,13 +14,13 @@ import findIndex from './findIndex.js'; * @returns {*} Returns the matched element, else `undefined`. * @example * - * var users = [ + * const users = [ * { 'user': 'barney', 'age': 36, 'active': true }, * { 'user': 'fred', 'age': 40, 'active': false }, * { 'user': 'pebbles', 'age': 1, 'active': true } * ]; * - * find(users, function(o) { return o.age < 40; }); + * find(users, o => o.age < 40); * // => object for 'barney' */ const find = createFind(findIndex); diff --git a/findIndex.js b/findIndex.js index b908b5053..fcf811742 100644 --- a/findIndex.js +++ b/findIndex.js @@ -16,13 +16,13 @@ const nativeMax = Math.max; * @returns {number} Returns the index of the found element, else `-1`. * @example * - * var users = [ + * const users = [ * { 'user': 'barney', 'active': false }, * { 'user': 'fred', 'active': false }, * { 'user': 'pebbles', 'active': true } * ]; * - * findIndex(users, function(o) { return o.user == 'barney'; }); + * findIndex(users, o => o.user == 'barney'); * // => 0 */ function findIndex(array, predicate, fromIndex) { diff --git a/findKey.js b/findKey.js index 6e9118c11..3d7ea3128 100644 --- a/findKey.js +++ b/findKey.js @@ -13,13 +13,13 @@ import baseForOwn from './.internal/baseForOwn.js'; * else `undefined`. * @example * - * var users = { + * const users = { * 'barney': { 'age': 36, 'active': true }, * 'fred': { 'age': 40, 'active': false }, * '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) */ function findKey(object, predicate) { diff --git a/findLast.js b/findLast.js index 8fd96371a..f82aae975 100644 --- a/findLast.js +++ b/findLast.js @@ -13,9 +13,7 @@ import findLastIndex from './findLastIndex.js'; * @returns {*} Returns the matched element, else `undefined`. * @example * - * findLast([1, 2, 3, 4], function(n) { - * return n % 2 == 1; - * }); + * findLast([1, 2, 3, 4], n => n % 2 == 1); * // => 3 */ const findLast = createFind(findLastIndex); diff --git a/findLastIndex.js b/findLastIndex.js index 87487446a..53f742908 100644 --- a/findLastIndex.js +++ b/findLastIndex.js @@ -17,13 +17,13 @@ const nativeMin = Math.min; * @returns {number} Returns the index of the found element, else `-1`. * @example * - * var users = [ + * const users = [ * { 'user': 'barney', 'active': true }, * { 'user': 'fred', 'active': false }, * { 'user': 'pebbles', 'active': false } * ]; * - * findLastIndex(users, function(o) { return o.user == 'pebbles'; }); + * findLastIndex(users, o => o.user == 'pebbles'); * // => 2 */ function findLastIndex(array, predicate, fromIndex) { diff --git a/findLastKey.js b/findLastKey.js index 816e93935..8ed2f1d8a 100644 --- a/findLastKey.js +++ b/findLastKey.js @@ -13,13 +13,13 @@ import baseForOwnRight from './.internal/baseForOwnRight.js'; * else `undefined`. * @example * - * var users = { + * const users = { * 'barney': { 'age': 36, 'active': true }, * 'fred': { 'age': 40, 'active': false }, * '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' */ function findLastKey(object, predicate) { diff --git a/flattenDepth.js b/flattenDepth.js index 8d69a1376..fc8d93cd7 100644 --- a/flattenDepth.js +++ b/flattenDepth.js @@ -11,7 +11,7 @@ import toInteger from './toInteger.js'; * @returns {Array} Returns the new flattened array. * @example * - * var array = [1, [2, [3, [4]], 5]]; + * const array = [1, [2, [3, [4]], 5]]; * * flattenDepth(array, 1); * // => [1, 2, [3, [4]], 5] diff --git a/flip.js b/flip.js index dd9d86512..741a68003 100644 --- a/flip.js +++ b/flip.js @@ -12,9 +12,7 @@ const WRAP_FLIP_FLAG = 512; * @returns {Function} Returns the new flipped function. * @example * - * var flipped = flip(function() { - * return toArray(arguments); - * }); + * const flipped = flip((...args) => args); * * flipped('a', 'b', 'c', 'd'); * // => ['d', 'c', 'b', 'a'] diff --git a/flow.js b/flow.js index 2be41fb5f..11b37bc32 100644 --- a/flow.js +++ b/flow.js @@ -16,7 +16,7 @@ import createFlow from './.internal/createFlow.js'; * return n * n; * } * - * var addSquare = flow([add, square]); + * const addSquare = flow([add, square]); * addSquare(1, 2); * // => 9 */ diff --git a/flowRight.js b/flowRight.js index 210adba64..7e60eae4c 100644 --- a/flowRight.js +++ b/flowRight.js @@ -15,7 +15,7 @@ import createFlow from './.internal/createFlow.js'; * return n * n; * } * - * var addSquare = flowRight([square, add]); + * const addSquare = flowRight([square, add]); * addSquare(1, 2); * // => 9 */ diff --git a/forEach.js b/forEach.js index 6e42aa49e..439874659 100644 --- a/forEach.js +++ b/forEach.js @@ -19,14 +19,10 @@ import baseEach from './.internal/baseEach.js';; * @see forEachRight * @example * - * forEach([1, 2], function(value) { - * console.log(value); - * }); + * forEach([1, 2], value => console.log(value)); * // => Logs `1` then `2`. * - * forEach({ 'a': 1, 'b': 2 }, function(value, key) { - * console.log(key); - * }); + * forEach({ 'a': 1, 'b': 2 }, (value, key) => console.log(key)); * // => Logs 'a' then 'b' (iteration order is not guaranteed). */ function forEach(collection, iteratee) { diff --git a/forEachRight.js b/forEachRight.js index c97f9b1b6..f09017ca7 100644 --- a/forEachRight.js +++ b/forEachRight.js @@ -14,9 +14,7 @@ import baseEachRight from './.internal/baseEachRight.js'; * @see forEach * @example * - * forEachRight([1, 2], function(value) { - * console.log(value); - * }); + * forEachRight([1, 2], value => console.log(value)); * // => Logs `2` then `1`. */ function forEachRight(collection, iteratee) { diff --git a/get.js b/get.js index ef52851b0..36c4a1bf0 100644 --- a/get.js +++ b/get.js @@ -12,7 +12,7 @@ import baseGet from './.internal/baseGet.js'; * @returns {*} Returns the resolved value. * @example * - * var object = { 'a': [{ 'b': { 'c': 3 } }] }; + * const object = { 'a': [{ 'b': { 'c': 3 } }] }; * * get(object, 'a[0].b.c'); * // => 3 diff --git a/has.js b/has.js index cfdce19c0..27024799b 100644 --- a/has.js +++ b/has.js @@ -11,8 +11,8 @@ import hasPath from './.internal/hasPath.js'; * @returns {boolean} Returns `true` if `path` exists, else `false`. * @example * - * var object = { 'a': { 'b': 2 } }; - * var other = create({ 'a': create({ 'b': 2 }) }); + * const object = { 'a': { 'b': 2 } }; + * const other = create({ 'a': create({ 'b': 2 }) }); * * has(object, 'a'); * // => true diff --git a/hasIn.js b/hasIn.js index 76bbc8d1f..41b39445e 100644 --- a/hasIn.js +++ b/hasIn.js @@ -11,7 +11,7 @@ import hasPath from './.internal/hasPath.js'; * @returns {boolean} Returns `true` if `path` exists, else `false`. * @example * - * var object = create({ 'a': create({ 'b': 2 }) }); + * const object = create({ 'a': create({ 'b': 2 }) }); * * hasIn(object, 'a'); * // => true diff --git a/identity.js b/identity.js index 587418436..778c6d3d7 100644 --- a/identity.js +++ b/identity.js @@ -7,7 +7,7 @@ * @returns {*} Returns `value`. * @example * - * var object = { 'a': 1 }; + * const object = { 'a': 1 }; * * console.log(identity(object) === object); * // => true diff --git a/intersectionWith.js b/intersectionWith.js index f4208ce83..24602cee7 100644 --- a/intersectionWith.js +++ b/intersectionWith.js @@ -16,8 +16,8 @@ import last from './last.js'; * @returns {Array} Returns the new array of intersecting values. * @example * - * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; - * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * const objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * const others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; * * intersectionWith(objects, others, isEqual); * // => [{ 'x': 1, 'y': 2 }] diff --git a/invert.js b/invert.js index 12550e95e..3934c70a7 100644 --- a/invert.js +++ b/invert.js @@ -13,7 +13,7 @@ import identity from './identity.js'; * @returns {Object} Returns the new inverted object. * @example * - * var object = { 'a': 1, 'b': 2, 'c': 1 }; + * const object = { 'a': 1, 'b': 2, 'c': 1 }; * * invert(object); * // => { '1': 'c', '2': 'b' } diff --git a/invertBy.js b/invertBy.js index e1739ff53..335d6b7cc 100644 --- a/invertBy.js +++ b/invertBy.js @@ -17,11 +17,9 @@ const hasOwnProperty = Object.prototype.hasOwnProperty; * @returns {Object} Returns the new inverted object. * @example * - * var object = { 'a': 1, 'b': 2, 'c': 1 }; + * const object = { 'a': 1, 'b': 2, 'c': 1 }; * - * invertBy(object, function(value) { - * return 'group' + value; - * }); + * invertBy(object, value => `group${ value }`); * // => { 'group1': ['a', 'c'], 'group2': ['b'] } */ const invertBy = createInverter((result, value, key) => { diff --git a/invoke.js b/invoke.js index 511d589df..fbf7ae43d 100644 --- a/invoke.js +++ b/invoke.js @@ -11,7 +11,7 @@ import baseInvoke from './.internal/baseInvoke.js'; * @returns {*} Returns the result of the invoked method. * @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); * // => [2, 3] diff --git a/isEqual.js b/isEqual.js index f7b925603..47d2d3ea8 100644 --- a/isEqual.js +++ b/isEqual.js @@ -17,8 +17,8 @@ import baseIsEqual from './.internal/baseIsEqual.js'; * @returns {boolean} Returns `true` if the values are equivalent, else `false`. * @example * - * var object = { 'a': 1 }; - * var other = { 'a': 1 }; + * const object = { 'a': 1 }; + * const other = { 'a': 1 }; * * isEqual(object, other); * // => true diff --git a/isEqualWith.js b/isEqualWith.js index 529eebcfc..0e0703a4e 100644 --- a/isEqualWith.js +++ b/isEqualWith.js @@ -24,8 +24,8 @@ import baseIsEqual from './.internal/baseIsEqual.js'; * } * } * - * var array = ['hello', 'goodbye']; - * var other = ['hi', 'goodbye']; + * const array = ['hello', 'goodbye']; + * const other = ['hi', 'goodbye']; * * isEqualWith(array, other, customizer); * // => true diff --git a/isMatch.js b/isMatch.js index 23c6dfcfb..ebee45374 100644 --- a/isMatch.js +++ b/isMatch.js @@ -19,7 +19,7 @@ import getMatchData from './.internal/getMatchData.js'; * @returns {boolean} Returns `true` if `object` is a match, else `false`. * @example * - * var object = { 'a': 1, 'b': 2 }; + * const object = { 'a': 1, 'b': 2 }; * * isMatch(object, { 'b': 2 }); * // => true diff --git a/isMatchWith.js b/isMatchWith.js index b089fb7db..d48fa74fb 100644 --- a/isMatchWith.js +++ b/isMatchWith.js @@ -25,8 +25,8 @@ import getMatchData from './.internal/getMatchData.js'; * } * } * - * var object = { 'greeting': 'hello' }; - * var source = { 'greeting': 'hi' }; + * const object = { 'greeting': 'hello' }; + * const source = { 'greeting': 'hi' }; * * isMatchWith(object, source, customizer); * // => true diff --git a/keyBy.js b/keyBy.js index ddbe55cc6..239c206f9 100644 --- a/keyBy.js +++ b/keyBy.js @@ -14,7 +14,7 @@ import createAggregator from './.internal/createAggregator.js'; * @returns {Object} Returns the composed aggregate object. * @example * - * var array = [ + * const array = [ * { 'dir': 'left', 'code': 97 }, * { 'dir': 'right', 'code': 100 } * ]; diff --git a/mapValues.js b/mapValues.js index 93e935e3c..a8cd437c1 100644 --- a/mapValues.js +++ b/mapValues.js @@ -15,12 +15,12 @@ import baseForOwn from './.internal/baseForOwn.js'; * @see mapKeys * @example * - * var users = { + * const users = { * 'fred': { 'user': 'fred', 'age': 40 }, * '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) */ function mapValues(object, iteratee) { diff --git a/matches.js b/matches.js index 4400f5acc..d15085bbb 100644 --- a/matches.js +++ b/matches.js @@ -22,7 +22,7 @@ const CLONE_DEEP_FLAG = 1; * @returns {Function} Returns the new spec function. * @example * - * var objects = [ + * const objects = [ * { 'a': 1, 'b': 2, 'c': 3 }, * { 'a': 4, 'b': 5, 'c': 6 } * ]; diff --git a/matchesProperty.js b/matchesProperty.js index 66a132c8f..f3c0389f6 100644 --- a/matchesProperty.js +++ b/matchesProperty.js @@ -20,7 +20,7 @@ const CLONE_DEEP_FLAG = 1; * @returns {Function} Returns the new spec function. * @example * - * var objects = [ + * const objects = [ * { 'a': 1, 'b': 2, 'c': 3 }, * { 'a': 4, 'b': 5, 'c': 6 } * ]; diff --git a/maxBy.js b/maxBy.js index 07d168234..9c3737095 100644 --- a/maxBy.js +++ b/maxBy.js @@ -13,9 +13,9 @@ import baseGt from './.internal/baseGt.js'; * @returns {*} Returns the maximum value. * @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 } */ function maxBy(array, iteratee) { diff --git a/meanBy.js b/meanBy.js index b48ec78b8..535ec8d27 100644 --- a/meanBy.js +++ b/meanBy.js @@ -15,9 +15,9 @@ const NAN = 0 / 0; * @returns {number} Returns the mean. * @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 */ function meanBy(array, iteratee) { diff --git a/memoize.js b/memoize.js index 2fb218616..8a57c309d 100644 --- a/memoize.js +++ b/memoize.js @@ -20,10 +20,10 @@ import MapCache from './.internal/MapCache.js'; * @returns {Function} Returns the new memoized function. * @example * - * var object = { 'a': 1, 'b': 2 }; - * var other = { 'c': 3, 'd': 4 }; + * const object = { 'a': 1, 'b': 2 }; + * const other = { 'c': 3, 'd': 4 }; * - * var values = memoize(values); + * const values = memoize(values); * values(object); * // => [1, 2] * diff --git a/merge.js b/merge.js index 2e359c570..aeb9595cb 100644 --- a/merge.js +++ b/merge.js @@ -19,11 +19,11 @@ import createAssigner from './.internal/createAssigner.js'; * @returns {Object} Returns `object`. * @example * - * var object = { + * const object = { * 'a': [{ 'b': 2 }, { 'd': 4 }] * }; * - * var other = { + * const other = { * 'a': [{ 'c': 3 }, { 'e': 5 }] * }; * diff --git a/mergeWith.js b/mergeWith.js index 953668945..02db25828 100644 --- a/mergeWith.js +++ b/mergeWith.js @@ -24,8 +24,8 @@ import createAssigner from './.internal/createAssigner.js'; * } * } * - * var object = { 'a': [1], 'b': [2] }; - * var other = { 'a': [3], 'b': [4] }; + * const object = { 'a': [1], 'b': [2] }; + * const other = { 'a': [3], 'b': [4] }; * * mergeWith(object, other, customizer); * // => { 'a': [1, 3], 'b': [2, 4] } diff --git a/method.js b/method.js index d9deb7625..048a45ba1 100644 --- a/method.js +++ b/method.js @@ -11,7 +11,7 @@ import baseInvoke from './.internal/baseInvoke.js'; * @returns {Function} Returns the new invoker function. * @example * - * var objects = [ + * const objects = [ * { 'a': { 'b': constant(2) } }, * { 'a': { 'b': constant(1) } } * ]; diff --git a/methodOf.js b/methodOf.js index 0c8fc6199..460123bb0 100644 --- a/methodOf.js +++ b/methodOf.js @@ -12,8 +12,8 @@ import baseInvoke from './.internal/baseInvoke.js'; * @returns {Function} Returns the new invoker function. * @example * - * var array = times(3, constant), - * object = { 'a': array, 'b': array, 'c': array }; + * const array = times(3, constant); + * const object = { 'a': array, 'b': array, 'c': array }; * * map(['a[2]', 'c[0]'], methodOf(object)); * // => [2, 0] diff --git a/minBy.js b/minBy.js index 60f593181..a76cf3da6 100644 --- a/minBy.js +++ b/minBy.js @@ -13,9 +13,9 @@ import baseLt from './.internal/baseLt.js'; * @returns {*} Returns the minimum value. * @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 } */ function minBy(array, iteratee) { diff --git a/nth.js b/nth.js index 22579b2e9..17e85be30 100644 --- a/nth.js +++ b/nth.js @@ -12,7 +12,7 @@ import toInteger from './toInteger.js'; * @returns {*} Returns the nth element of `array`. * @example * - * var array = ['a', 'b', 'c', 'd']; + * const array = ['a', 'b', 'c', 'd']; * * nth(array, 1); * // => 'b' diff --git a/nthArg.js b/nthArg.js index 295075e6d..40eaccb4f 100644 --- a/nthArg.js +++ b/nthArg.js @@ -11,11 +11,11 @@ import toInteger from './toInteger.js'; * @returns {Function} Returns the new pass-thru function. * @example * - * var func = nthArg(1); + * const func = nthArg(1); * func('a', 'b', 'c', 'd'); * // => 'b' * - * var func = nthArg(-2); + * const func = nthArg(-2); * func('a', 'b', 'c', 'd'); * // => 'c' */ diff --git a/once.js b/once.js index 41c650f43..696c00f7e 100644 --- a/once.js +++ b/once.js @@ -11,7 +11,7 @@ import before from './before.js'; * @returns {Function} Returns the new restricted function. * @example * - * var initialize = once(createApplication); + * const initialize = once(createApplication); * initialize(); * initialize(); * // => `createApplication` is invoked once diff --git a/orderBy.js b/orderBy.js index 4df0a2323..fcd30fe5f 100644 --- a/orderBy.js +++ b/orderBy.js @@ -16,7 +16,7 @@ import baseOrderBy from './.internal/baseOrderBy.js'; * @returns {Array} Returns the new sorted array. * @example * - * var users = [ + * const users = [ * { 'user': 'fred', 'age': 48 }, * { 'user': 'barney', 'age': 34 }, * { 'user': 'fred', 'age': 40 }, diff --git a/over.js b/over.js index 6186c74eb..e7ef33f33 100644 --- a/over.js +++ b/over.js @@ -12,7 +12,7 @@ import createOver from './.internal/createOver.js'; * @returns {Function} Returns the new function. * @example * - * var func = over([Math.max, Math.min]); + * const func = over([Math.max, Math.min]); * * func(1, 2, 3, 4); * // => [4, 1] diff --git a/overArgs.js b/overArgs.js index e6c3adfae..0757be965 100644 --- a/overArgs.js +++ b/overArgs.js @@ -23,9 +23,7 @@ const nativeMin = Math.min; * return n * n; * } * - * var func = overArgs(function(x, y) { - * return [x, y]; - * }, [square, doubled]); + * const func = overArgs((x, y) => [x, y], [square, doubled]); * * func(9, 3); * // => [81, 6] diff --git a/overEvery.js b/overEvery.js index 685a3aa1b..534702f3c 100644 --- a/overEvery.js +++ b/overEvery.js @@ -12,7 +12,7 @@ import createOver from './.internal/createOver.js'; * @returns {Function} Returns the new function. * @example * - * var func = overEvery([Boolean, isFinite]); + * const func = overEvery([Boolean, isFinite]); * * func('1'); * // => true diff --git a/overSome.js b/overSome.js index 95ef5c3cd..93b98a3c8 100644 --- a/overSome.js +++ b/overSome.js @@ -12,7 +12,7 @@ import createOver from './.internal/createOver.js'; * @returns {Function} Returns the new function. * @example * - * var func = overSome([Boolean, isFinite]); + * const func = overSome([Boolean, isFinite]); * * func('1'); * // => true diff --git a/partition.js b/partition.js index 51dbca9ef..921636901 100644 --- a/partition.js +++ b/partition.js @@ -13,13 +13,13 @@ import createAggregator from './.internal/createAggregator.js'; * @returns {Array} Returns the array of grouped elements. * @example * - * var users = [ + * const users = [ * { 'user': 'barney', 'age': 36, 'active': false }, * { 'user': 'fred', 'age': 40, 'active': true }, * { 'user': 'pebbles', 'age': 1, 'active': false } * ]; * - * partition(users, function(o) { return o.active; }); + * partition(users, o => o.active); * // => objects for [['fred'], ['barney', 'pebbles']] */ const partition = createAggregator((result, value, key) => diff --git a/pick.js b/pick.js index 49721026e..f9da4c4ae 100644 --- a/pick.js +++ b/pick.js @@ -10,7 +10,7 @@ import basePick from './.internal/basePick.js'; * @returns {Object} Returns the new object. * @example * - * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * const object = { 'a': 1, 'b': '2', 'c': 3 }; * * pick(object, ['a', 'c']); * // => { 'a': 1, 'c': 3 } diff --git a/pickBy.js b/pickBy.js index e9f72cbed..0c213f05f 100644 --- a/pickBy.js +++ b/pickBy.js @@ -13,7 +13,7 @@ import getAllKeysIn from './.internal/getAllKeysIn.js'; * @returns {Object} Returns the new object. * @example * - * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * const object = { 'a': 1, 'b': '2', 'c': 3 }; * * pickBy(object, isNumber); * // => { 'a': 1, 'c': 3 } diff --git a/property.js b/property.js index 3988e5626..ae80f201d 100644 --- a/property.js +++ b/property.js @@ -12,7 +12,7 @@ import toKey from './.internal/toKey.js'; * @returns {Function} Returns the new accessor function. * @example * - * var objects = [ + * const objects = [ * { 'a': { 'b': 2 } }, * { 'a': { 'b': 1 } } * ]; diff --git a/propertyOf.js b/propertyOf.js index cbea913af..e9672b58e 100644 --- a/propertyOf.js +++ b/propertyOf.js @@ -10,8 +10,8 @@ import baseGet from './.internal/baseGet.js'; * @returns {Function} Returns the new accessor function. * @example * - * var array = [0, 1, 2], - * object = { 'a': array, 'b': array, 'c': array }; + * const array = [0, 1, 2]; + * const object = { 'a': array, 'b': array, 'c': array }; * * map(['a[2]', 'c[0]'], propertyOf(object)); * // => [2, 0] diff --git a/pull.js b/pull.js index f27a753cb..add12b67e 100644 --- a/pull.js +++ b/pull.js @@ -15,7 +15,7 @@ import pullAll from './pullAll.js'; * @returns {Array} Returns `array`. * @example * - * var array = ['a', 'b', 'c', 'a', 'b', 'c']; + * const array = ['a', 'b', 'c', 'a', 'b', 'c']; * * pull(array, 'a', 'c'); * console.log(array); diff --git a/pullAll.js b/pullAll.js index 1e874f7e2..4af651bf5 100644 --- a/pullAll.js +++ b/pullAll.js @@ -12,7 +12,7 @@ import basePullAll from './.internal/basePullAll.js'; * @returns {Array} Returns `array`. * @example * - * var array = ['a', 'b', 'c', 'a', 'b', 'c']; + * const array = ['a', 'b', 'c', 'a', 'b', 'c']; * * pullAll(array, ['a', 'c']); * console.log(array); diff --git a/pullAllBy.js b/pullAllBy.js index aa79098b4..0523a690d 100644 --- a/pullAllBy.js +++ b/pullAllBy.js @@ -15,7 +15,7 @@ import basePullAll from './.internal/basePullAll.js'; * @returns {Array} Returns `array`. * @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'); * console.log(array); diff --git a/pullAllWith.js b/pullAllWith.js index f16a1909b..c631725c0 100644 --- a/pullAllWith.js +++ b/pullAllWith.js @@ -15,7 +15,7 @@ import basePullAll from './.internal/basePullAll.js'; * @returns {Array} Returns `array`. * @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); * console.log(array); diff --git a/pullAt.js b/pullAt.js index 3fc46e198..554170fbd 100644 --- a/pullAt.js +++ b/pullAt.js @@ -17,8 +17,8 @@ import isIndex from './.internal/isIndex.js'; * @returns {Array} Returns the new array of removed elements. * @example * - * var array = ['a', 'b', 'c', 'd']; - * var pulled = pullAt(array, [1, 3]); + * const array = ['a', 'b', 'c', 'd']; + * const pulled = pullAt(array, [1, 3]); * * console.log(array); * // => ['a', 'c'] diff --git a/rearg.js b/rearg.js index c76e4768c..1ceaa8a89 100644 --- a/rearg.js +++ b/rearg.js @@ -16,11 +16,9 @@ const WRAP_REARG_FLAG = 256; * @returns {Function} Returns the new function. * @example * - * var rearged = rearg(function(a, b, c) { - * return [a, b, c]; - * }, [2, 0, 1]); + * const rearged = rearg((a, b, c) => [a, b, c], [2, 0, 1]); * - * rearged('b', 'c', 'a') + * rearged('b', 'c', 'a'); * // => ['a', 'b', 'c'] */ function rearg(func, ...indexes) { diff --git a/reduce.js b/reduce.js index 5f7a44ae4..9355a2dd4 100644 --- a/reduce.js +++ b/reduce.js @@ -26,12 +26,10 @@ import baseReduce from './.internal/baseReduce.js'; * @see reduceRight * @example * - * reduce([1, 2], function(sum, n) { - * return sum + n; - * }, 0); + * reduce([1, 2], (sum, n) => sum + n, 0); * // => 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); * return result; * }, {}); diff --git a/reduceRight.js b/reduceRight.js index 9b65d7f30..e9d833b08 100644 --- a/reduceRight.js +++ b/reduceRight.js @@ -15,11 +15,9 @@ import baseReduce from './.internal/baseReduce.js'; * @see reduce * @example * - * var array = [[0, 1], [2, 3], [4, 5]]; + * const array = [[0, 1], [2, 3], [4, 5]]; * - * reduceRight(array, function(flattened, other) { - * return flattened.concat(other); - * }, []); + * reduceRight(array, (flattened, other) => flattened.concat(other), []); * // => [4, 5, 2, 3, 0, 1] */ function reduceRight(collection, iteratee, accumulator) { diff --git a/reject.js b/reject.js index 7af57444b..6a91ddf62 100644 --- a/reject.js +++ b/reject.js @@ -14,12 +14,12 @@ import negate from './negate.js'; * @see filter * @example * - * var users = [ + * const users = [ * { 'user': 'barney', 'age': 36, 'active': false }, * { 'user': 'fred', 'age': 40, 'active': true } * ]; * - * reject(users, function(o) { return !o.active; }); + * reject(users, o => !o.active); * // => objects for ['fred'] */ function reject(collection, predicate) { diff --git a/remove.js b/remove.js index 4a86931e8..e09040e32 100644 --- a/remove.js +++ b/remove.js @@ -15,10 +15,8 @@ import basePullAt from './.internal/basePullAt.js'; * @returns {Array} Returns the new array of removed elements. * @example * - * var array = [1, 2, 3, 4]; - * var evens = remove(array, function(n) { - * return n % 2 == 0; - * }); + * const array = [1, 2, 3, 4]; + * const evens = remove(array, n => n % 2 == 0); * * console.log(array); * // => [1, 3] diff --git a/result.js b/result.js index 8bd2a992f..a41fcad03 100644 --- a/result.js +++ b/result.js @@ -15,7 +15,7 @@ import toKey from './.internal/toKey.js'; * @returns {*} Returns the resolved value. * @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'); * // => 3 diff --git a/reverse.js b/reverse.js index 634640dcf..02a07999f 100644 --- a/reverse.js +++ b/reverse.js @@ -14,7 +14,7 @@ const nativeReverse = Array.prototype.reverse; * @returns {Array} Returns `array`. * @example * - * var array = [1, 2, 3]; + * const array = [1, 2, 3]; * * reverse(array); * // => [3, 2, 1] diff --git a/set.js b/set.js index 5a72b046d..5b5340a7b 100644 --- a/set.js +++ b/set.js @@ -16,7 +16,7 @@ import baseSet from './.internal/baseSet.js'; * @returns {Object} Returns `object`. * @example * - * var object = { 'a': [{ 'b': { 'c': 3 } }] }; + * const object = { 'a': [{ 'b': { 'c': 3 } }] }; * * set(object, 'a[0].b.c', 4); * console.log(object.a[0].b.c); diff --git a/setWith.js b/setWith.js index 72edca7e7..c1c4b7502 100644 --- a/setWith.js +++ b/setWith.js @@ -17,7 +17,7 @@ import baseSet from './.internal/baseSet.js'; * @returns {Object} Returns `object`. * @example * - * var object = {}; + * const object = {}; * * setWith(object, '[0][1]', 'a', Object); * // => { '0': { '1': 'a' } } diff --git a/sortedIndexBy.js b/sortedIndexBy.js index ac98311d7..ff4b46608 100644 --- a/sortedIndexBy.js +++ b/sortedIndexBy.js @@ -14,9 +14,9 @@ import baseSortedIndexBy from './.internal/baseSortedIndexBy.js'; * into `array`. * @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 */ function sortedIndexBy(array, value, iteratee) { diff --git a/sortedLastIndexBy.js b/sortedLastIndexBy.js index bce27a40b..325ab21d9 100644 --- a/sortedLastIndexBy.js +++ b/sortedLastIndexBy.js @@ -14,9 +14,9 @@ import baseSortedIndexBy from './.internal/baseSortedIndexBy.js'; * into `array`. * @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 */ function sortedLastIndexBy(array, value, iteratee) { diff --git a/spread.js b/spread.js index d112886cb..0a80af3ee 100644 --- a/spread.js +++ b/spread.js @@ -21,21 +21,17 @@ const nativeMax = Math.max; * @returns {Function} Returns the new function. * @example * - * var say = spread(function(who, what) { - * return who + ' says ' + what; - * }); + * const say = spread((who, what) => `${ who } says ${ what }`); * * say(['fred', 'hello']); * // => 'fred says hello' * - * var numbers = Promise.all([ + * const numbers = Promise.all([ * Promise.resolve(40), * Promise.resolve(36) * ]); * - * numbers.then(spread(function(x, y) { - * return x + y; - * })); + * numbers.then(spread((x, y) => x + y)); * // => a Promise of 76 */ function spread(func, start) { diff --git a/stubArray.js b/stubArray.js index 2432b7ce7..736bdec40 100644 --- a/stubArray.js +++ b/stubArray.js @@ -6,7 +6,7 @@ * @returns {Array} Returns the new empty array. * @example * - * var arrays = times(2, stubArray); + * const arrays = times(2, stubArray); * * console.log(arrays); * // => [[], []] diff --git a/stubObject.js b/stubObject.js index f2a891a3f..7997c17a9 100644 --- a/stubObject.js +++ b/stubObject.js @@ -6,7 +6,7 @@ * @returns {Object} Returns the new empty object. * @example * - * var objects = times(2, stubObject); + * const objects = times(2, stubObject); * * console.log(objects); * // => [{}, {}] diff --git a/sumBy.js b/sumBy.js index 78c29f9e9..638239f3b 100644 --- a/sumBy.js +++ b/sumBy.js @@ -12,9 +12,9 @@ import baseSum from './.internal/baseSum.js'; * @returns {number} Returns the sum. * @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 */ function sumBy(array, iteratee) { diff --git a/takeRightWhile.js b/takeRightWhile.js index d1764b7bd..63ebf9dd3 100644 --- a/takeRightWhile.js +++ b/takeRightWhile.js @@ -12,13 +12,13 @@ import baseWhile from './.internal/baseWhile.js'; * @returns {Array} Returns the slice of `array`. * @example * - * var users = [ + * const users = [ * { 'user': 'barney', 'active': true }, * { 'user': 'fred', 'active': false }, * { 'user': 'pebbles', 'active': false } * ]; * - * takeRightWhile(users, function(o) { return !o.active; }); + * takeRightWhile(users, o => !o.active); * // => objects for ['fred', 'pebbles'] */ function takeRightWhile(array, predicate) { diff --git a/takeWhile.js b/takeWhile.js index 56b418171..c9c889ba5 100644 --- a/takeWhile.js +++ b/takeWhile.js @@ -12,13 +12,13 @@ import baseWhile from './.internal/baseWhile.js'; * @returns {Array} Returns the slice of `array`. * @example * - * var users = [ + * const users = [ * { 'user': 'barney', 'active': false }, * { 'user': 'fred', 'active': false }, * { 'user': 'pebbles', 'active': true } * ]; * - * takeWhile(users, function(o) { return !o.active; }); + * takeWhile(users, o => !o.active); * // => objects for ['barney', 'fred'] */ function takeWhile(array, predicate) { diff --git a/template.js b/template.js index 3521cbe34..f0d8de26a 100644 --- a/template.js +++ b/template.js @@ -65,66 +65,66 @@ const reUnescapedString = /['\n\r\u2028\u2029\\]/g; * @example * * // Use the "interpolate" delimiter to create a compiled template. - * var compiled = template('hello <%= user %>!'); + * let compiled = template('hello <%= user %>!'); * compiled({ 'user': 'fred' }); * // => 'hello fred!' * * // Use the HTML "escape" delimiter to escape data property values. - * var compiled = template('<%- value %>'); + * let compiled = template('<%- value %>'); * compiled({ 'value': '