From d8bc95999f34d729db06db8b920664f113e54810 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Wed, 3 Feb 2016 01:09:45 -0800 Subject: [PATCH] Bump to v4.2.1. --- README.md | 4 ++-- bind.js | 4 +++- bindKey.js | 4 +++- core.js | 4 ++-- debounce.js | 2 +- fp/_baseConvert.js | 19 ++++++++++--------- fp/_mapping.js | 14 ++++++++++---- fp/trimChars.js | 2 ++ fp/trimCharsEnd.js | 2 ++ fp/trimCharsStart.js | 2 ++ lodash.js | 34 +++++++++++++++++++++------------- package.json | 2 +- partial.js | 4 +++- partialRight.js | 4 +++- pullAllBy.js | 2 +- throttle.js | 2 +- 16 files changed, 67 insertions(+), 38 deletions(-) create mode 100644 fp/trimChars.js create mode 100644 fp/trimCharsEnd.js create mode 100644 fp/trimCharsStart.js diff --git a/README.md b/README.md index 71bfe82c7..9a0dfcd1a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# lodash v4.2.0 +# lodash v4.2.1 The [lodash](https://lodash.com/) library exported as [Node.js](https://nodejs.org/) modules. @@ -28,7 +28,7 @@ var chunk = require('lodash/chunk'); var extend = require('lodash/fp/extend'); ``` -See the [package source](https://github.com/lodash/lodash/tree/4.2.0-npm) for more details. +See the [package source](https://github.com/lodash/lodash/tree/4.2.1-npm) for more details. **Note:**
Don’t assign values to the [special variable](http://nodejs.org/api/repl.html#repl_repl_features) `_` when in the REPL.
diff --git a/bind.js b/bind.js index 72e26338d..2a50568fb 100644 --- a/bind.js +++ b/bind.js @@ -44,7 +44,9 @@ var BIND_FLAG = 1, var bind = rest(function(func, thisArg, partials) { var bitmask = BIND_FLAG; if (partials.length) { - var holders = replaceHolders(partials, bind.placeholder); + var placeholder = bind.placeholder, + holders = replaceHolders(partials, placeholder); + bitmask |= PARTIAL_FLAG; } return createWrapper(func, bitmask, thisArg, partials, holders); diff --git a/bindKey.js b/bindKey.js index 74b4e1495..ba8e1cb29 100644 --- a/bindKey.js +++ b/bindKey.js @@ -54,7 +54,9 @@ var BIND_FLAG = 1, var bindKey = rest(function(object, key, partials) { var bitmask = BIND_FLAG | BIND_KEY_FLAG; if (partials.length) { - var holders = replaceHolders(partials, bindKey.placeholder); + var placeholder = bindKey.placeholder, + holders = replaceHolders(partials, placeholder); + bitmask |= PARTIAL_FLAG; } return createWrapper(key, bitmask, object, partials, holders); diff --git a/core.js b/core.js index 168de5663..120fdd867 100644 --- a/core.js +++ b/core.js @@ -1,6 +1,6 @@ /** * @license - * lodash 4.2.0 (Custom Build) + * lodash 4.2.1 (Custom Build) * Build: `lodash core -o ./dist/lodash.core.js` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -13,7 +13,7 @@ var undefined; /** Used as the semantic version number. */ - var VERSION = '4.2.0'; + var VERSION = '4.2.1'; /** Used to compose bitmasks for wrapper metadata. */ var BIND_FLAG = 1, diff --git a/debounce.js b/debounce.js index 92a5d6665..fadf716ab 100644 --- a/debounce.js +++ b/debounce.js @@ -19,7 +19,7 @@ var nativeMax = Math.max; * to the debounced function return the result of the last `func` invocation. * * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked - * on the trailing edge of the timeout only if the the debounced function is + * on the trailing edge of the timeout only if the debounced function is * invoked more than once during the `wait` timeout. * * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation) diff --git a/fp/_baseConvert.js b/fp/_baseConvert.js index d85983ca7..2af63a7f0 100644 --- a/fp/_baseConvert.js +++ b/fp/_baseConvert.js @@ -30,7 +30,7 @@ function baseConvert(util, name, func) { 'iteratee': util.iteratee, 'keys': util.keys, 'rearg': util.rearg, - 'rest': util.rest + 'spread': util.spread }; var ary = _.ary, @@ -156,14 +156,15 @@ function baseConvert(util, name, func) { if (wrapper) { return wrapper(func); } + var wrapped = func; if (mutateMap.array[name]) { - func = immutWrap(func, cloneArray); + wrapped = immutWrap(func, cloneArray); } else if (mutateMap.object[name]) { - func = immutWrap(func, createCloner(func)); + wrapped = immutWrap(func, createCloner(func)); } else if (mutateMap.set[name]) { - func = immutWrap(func, cloneDeep); + wrapped = immutWrap(func, cloneDeep); } var result; each(mapping.caps, function(cap) { @@ -174,8 +175,8 @@ function baseConvert(util, name, func) { spreadStart = mapping.methodSpread[name]; result = spreadStart === undefined - ? ary(func, cap) - : spread(func, spreadStart); + ? ary(wrapped, cap) + : spread(wrapped, spreadStart); if (cap > 1 && !mapping.skipRearg[name]) { result = rearg(result, mapping.methodRearg[name] || mapping.aryRearg[cap]); @@ -196,7 +197,7 @@ function baseConvert(util, name, func) { result || (result = func); if (mapping.placeholder[name]) { - result.placeholder = placeholder; + func.placeholder = result.placeholder = placeholder; } return result; }; @@ -204,8 +205,8 @@ function baseConvert(util, name, func) { if (!isLib) { return wrap(name, func); } - // Add placeholder alias. - _.__ = placeholder; + // Add placeholder. + _.placeholder = placeholder; // Iterate over methods for the current ary cap. var pairs = []; diff --git a/fp/_mapping.js b/fp/_mapping.js index 3fe602629..8b8e24b75 100644 --- a/fp/_mapping.js +++ b/fp/_mapping.js @@ -1,5 +1,6 @@ /** Used to map aliases to their real names. */ exports.aliasToReal = { + '__': 'placeholder', 'all': 'some', 'allPass': 'overEvery', 'apply': 'spread', @@ -60,9 +61,9 @@ exports.aryMethod = { 'repeat', 'result', 'sampleSize', 'some', 'sortBy', 'sortedIndex', 'sortedIndexOf', 'sortedLastIndex', 'sortedLastIndexOf', 'sortedUniqBy', 'split', 'startsWith', 'subtract', 'sumBy', 'take', 'takeRight', 'takeRightWhile', - 'takeWhile', 'tap', 'throttle', 'thru', 'times', 'truncate', 'union', 'uniqBy', - 'uniqWith', 'unset', 'unzipWith', 'without', 'wrap', 'xor', 'zip', 'zipObject', - 'zipObjectDeep' + 'takeWhile', 'tap', 'throttle', 'thru', 'times', 'trimChars', 'trimCharsEnd', + 'trimCharsStart', 'truncate', 'union', 'uniqBy', 'uniqWith', 'unset', + 'unzipWith', 'without', 'wrap', 'xor', 'zip', 'zipObject', 'zipObjectDeep' ], 3: [ 'assignInWith', 'assignWith', 'clamp', 'differenceBy', 'differenceWith', @@ -212,11 +213,15 @@ exports.realToAlias = (function() { exports.rename = { 'curryN': 'curry', 'curryRightN': 'curryRight', - 'getOr': 'get' + 'getOr': 'get', + 'trimChars': 'trim', + 'trimCharsEnd': 'trimEnd', + 'trimCharsStart': 'trimStart' }; /** Used to track methods that skip `_.rearg`. */ exports.skipRearg = { + 'add': true, 'assign': true, 'assignIn': true, 'concat': true, @@ -228,6 +233,7 @@ exports.skipRearg = { 'random': true, 'range': true, 'rangeRight': true, + 'subtract': true, 'zip': true, 'zipObject': true }; diff --git a/fp/trimChars.js b/fp/trimChars.js new file mode 100644 index 000000000..051ea1e6e --- /dev/null +++ b/fp/trimChars.js @@ -0,0 +1,2 @@ +var convert = require('./convert'); +module.exports = convert('trimChars', require('../trim')); diff --git a/fp/trimCharsEnd.js b/fp/trimCharsEnd.js new file mode 100644 index 000000000..54c5cff72 --- /dev/null +++ b/fp/trimCharsEnd.js @@ -0,0 +1,2 @@ +var convert = require('./convert'); +module.exports = convert('trimCharsEnd', require('../trimEnd')); diff --git a/fp/trimCharsStart.js b/fp/trimCharsStart.js new file mode 100644 index 000000000..44f986650 --- /dev/null +++ b/fp/trimCharsStart.js @@ -0,0 +1,2 @@ +var convert = require('./convert'); +module.exports = convert('trimCharsStart', require('../trimStart')); diff --git a/lodash.js b/lodash.js index e78a24801..97f4b4afe 100644 --- a/lodash.js +++ b/lodash.js @@ -1,6 +1,6 @@ /** * @license - * lodash 4.2.0 (Custom Build) + * lodash 4.2.1 (Custom Build) * Build: `lodash -d -o ./foo/lodash.js` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -13,7 +13,7 @@ var undefined; /** Used as the semantic version number. */ - var VERSION = '4.2.0'; + var VERSION = '4.2.1'; /** Used to compose bitmasks for wrapper metadata. */ var BIND_FLAG = 1, @@ -4123,7 +4123,7 @@ index = length, args = Array(length), fn = (this && this !== root && this instanceof wrapper) ? Ctor : func, - placeholder = wrapper.placeholder; + placeholder = lodash.placeholder || wrapper.placeholder; while (index--) { args[index] = arguments[index]; @@ -4239,7 +4239,7 @@ args = composeArgsRight(args, partialsRight, holdersRight); } if (isCurry || isCurryRight) { - var placeholder = wrapper.placeholder, + var placeholder = lodash.placeholder || wrapper.placeholder, argsHolders = replaceHolders(args, placeholder); length -= argsHolders.length; @@ -6129,7 +6129,7 @@ /** * This method is like `_.pullAll` except that it accepts `iteratee` which is - * invoked for each element of `array` and `values` to to generate the criterion + * invoked for each element of `array` and `values` to generate the criterion * by which uniqueness is computed. The iteratee is invoked with one argument: (value). * * **Note:** Unlike `_.differenceBy`, this method mutates `array`. @@ -8346,7 +8346,9 @@ var bind = rest(function(func, thisArg, partials) { var bitmask = BIND_FLAG; if (partials.length) { - var holders = replaceHolders(partials, bind.placeholder); + var placeholder = lodash.placeholder || bind.placeholder, + holders = replaceHolders(partials, placeholder); + bitmask |= PARTIAL_FLAG; } return createWrapper(func, bitmask, thisArg, partials, holders); @@ -8399,7 +8401,9 @@ var bindKey = rest(function(object, key, partials) { var bitmask = BIND_FLAG | BIND_KEY_FLAG; if (partials.length) { - var holders = replaceHolders(partials, bindKey.placeholder); + var placeholder = lodash.placeholder || bindKey.placeholder, + holders = replaceHolders(partials, placeholder); + bitmask |= PARTIAL_FLAG; } return createWrapper(key, bitmask, object, partials, holders); @@ -8448,7 +8452,7 @@ function curry(func, arity, guard) { arity = guard ? undefined : arity; var result = createWrapper(func, CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity); - result.placeholder = curry.placeholder; + result.placeholder = lodash.placeholder || curry.placeholder; return result; } @@ -8492,7 +8496,7 @@ function curryRight(func, arity, guard) { arity = guard ? undefined : arity; var result = createWrapper(func, CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity); - result.placeholder = curryRight.placeholder; + result.placeholder = lodash.placeholder || curryRight.placeholder; return result; } @@ -8507,7 +8511,7 @@ * to the debounced function return the result of the last `func` invocation. * * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked - * on the trailing edge of the timeout only if the the debounced function is + * on the trailing edge of the timeout only if the debounced function is * invoked more than once during the `wait` timeout. * * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation) @@ -8914,7 +8918,9 @@ * // => 'hi fred' */ var partial = rest(function(func, partials) { - var holders = replaceHolders(partials, partial.placeholder); + var placeholder = lodash.placeholder || partial.placeholder, + holders = replaceHolders(partials, placeholder); + return createWrapper(func, PARTIAL_FLAG, undefined, partials, holders); }); @@ -8950,7 +8956,9 @@ * // => 'hello fred' */ var partialRight = rest(function(func, partials) { - var holders = replaceHolders(partials, partialRight.placeholder); + var placeholder = lodash.placeholder || partialRight.placeholder, + holders = replaceHolders(partials, placeholder); + return createWrapper(func, PARTIAL_RIGHT_FLAG, undefined, partials, holders); }); @@ -9089,7 +9097,7 @@ * result of the last `func` invocation. * * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked - * on the trailing edge of the timeout only if the the throttled function is + * on the trailing edge of the timeout only if the throttled function is * invoked more than once during the `wait` timeout. * * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation) diff --git a/package.json b/package.json index 11fecc667..8fe6b0536 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lodash", - "version": "4.2.0", + "version": "4.2.1", "description": "Lodash modular utilities.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/partial.js b/partial.js index 91ba539a5..e29a593fa 100644 --- a/partial.js +++ b/partial.js @@ -38,7 +38,9 @@ var PARTIAL_FLAG = 32; * // => 'hi fred' */ var partial = rest(function(func, partials) { - var holders = replaceHolders(partials, partial.placeholder); + var placeholder = partial.placeholder, + holders = replaceHolders(partials, placeholder); + return createWrapper(func, PARTIAL_FLAG, undefined, partials, holders); }); diff --git a/partialRight.js b/partialRight.js index f696bf897..502f3a474 100644 --- a/partialRight.js +++ b/partialRight.js @@ -37,7 +37,9 @@ var PARTIAL_RIGHT_FLAG = 64; * // => 'hello fred' */ var partialRight = rest(function(func, partials) { - var holders = replaceHolders(partials, partialRight.placeholder); + var placeholder = partialRight.placeholder, + holders = replaceHolders(partials, placeholder); + return createWrapper(func, PARTIAL_RIGHT_FLAG, undefined, partials, holders); }); diff --git a/pullAllBy.js b/pullAllBy.js index 36864e351..7d732e70c 100644 --- a/pullAllBy.js +++ b/pullAllBy.js @@ -3,7 +3,7 @@ var baseIteratee = require('./_baseIteratee'), /** * This method is like `_.pullAll` except that it accepts `iteratee` which is - * invoked for each element of `array` and `values` to to generate the criterion + * invoked for each element of `array` and `values` to generate the criterion * by which uniqueness is computed. The iteratee is invoked with one argument: (value). * * **Note:** Unlike `_.differenceBy`, this method mutates `array`. diff --git a/throttle.js b/throttle.js index 72f1f71c5..ff7dc7579 100644 --- a/throttle.js +++ b/throttle.js @@ -15,7 +15,7 @@ var FUNC_ERROR_TEXT = 'Expected a function'; * result of the last `func` invocation. * * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked - * on the trailing edge of the timeout only if the the throttled function is + * on the trailing edge of the timeout only if the throttled function is * invoked more than once during the `wait` timeout. * * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation)