...**/!(*.map|*.min.js)Size
Gzip
Dependencies
Publish
Install
@@ -1,6 +1,6 @@ | |||
| 1 | { | 1 | { |
| 2 | "name": "lodash", | 2 | "name": "lodash", |
| 3 | "version": "4.16.6", | 3 | "version": "4.17.0", |
| 4 | "description": "Lodash modular utilities.", | 4 | "description": "Lodash modular utilities.", |
| 5 | "keywords": "modules, stdlib, util", | 5 | "keywords": "modules, stdlib, util", |
| 6 | "homepage": "https://lodash.com/", | 6 | "homepage": "https://lodash.com/", |
@@ -11,7 +11,6 @@ | |||
| 11 | "author": "John-David Dalton <john.david.dalton@gmail.com> (http://allyoucanleet.com/)", | 11 | "author": "John-David Dalton <john.david.dalton@gmail.com> (http://allyoucanleet.com/)", |
| 12 | "contributors": [ | 12 | "contributors": [ |
| 13 | "John-David Dalton <john.david.dalton@gmail.com> (http://allyoucanleet.com/)", | 13 | "John-David Dalton <john.david.dalton@gmail.com> (http://allyoucanleet.com/)", |
| 14 | "Blaine Bublitz <blaine.bublitz@gmail.com> (https://github.com/phated)", | ||
| 15 | "Mathias Bynens <mathias@qiwi.be> (https://mathiasbynens.be/)" | 14 | "Mathias Bynens <mathias@qiwi.be> (https://mathiasbynens.be/)" |
| 16 | ], | 15 | ], |
| 17 | "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } | 16 | "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } |
@@ -1,4 +1,4 @@ | |||
| 1 | # lodash v4.16.6 | 1 | # lodash v4.17.0 |
| 2 | 2 | ||
| 3 | The [Lodash](https://lodash.com/) library exported as [Node.js](https://nodejs.org/) modules. | 3 | The [Lodash](https://lodash.com/) library exported as [Node.js](https://nodejs.org/) modules. |
| 4 | 4 | ||
@@ -28,7 +28,7 @@ | |||
| 28 | var curryN = require('lodash/fp/curryN'); | 28 | var curryN = require('lodash/fp/curryN'); |
| 29 | ``` | 29 | ``` |
| 30 | 30 | ||
| 31 | See the [package source](https://github.com/lodash/lodash/tree/4.16.6-npm) for more details. | 31 | See the [package source](https://github.com/lodash/lodash/tree/4.17.0-npm) for more details. |
| 32 | 32 | ||
| 33 | **Note:**<br> | 33 | **Note:**<br> |
| 34 | Install [n_](https://www.npmjs.com/package/n_) for Lodash use in the Node.js < 6 REPL. | 34 | Install [n_](https://www.npmjs.com/package/n_) for Lodash use in the Node.js < 6 REPL. |
@@ -1,5 +1,8 @@ | |||
| 1 | var baseClone = require('./_baseClone'); | 1 | var baseClone = require('./_baseClone'); |
| 2 | 2 | ||
| 3 | /** Used to compose bitmasks for cloning. */ | ||
| 4 | var CLONE_SYMBOLS_FLAG = 4; | ||
| 5 | |||
| 3 | /** | 6 | /** |
| 4 | * Creates a shallow clone of `value`. | 7 | * Creates a shallow clone of `value`. |
| 5 | * | 8 | * |
@@ -27,7 +30,7 @@ | |||
| 27 | * // => true | 30 | * // => true |
| 28 | */ | 31 | */ |
| 29 | function clone(value) { | 32 | function clone(value) { |
| 30 | return baseClone(value, false, true); | 33 | return baseClone(value, CLONE_SYMBOLS_FLAG); |
| 31 | } | 34 | } |
| 32 | 35 | ||
| 33 | module.exports = clone; | 36 | module.exports = clone; |
@@ -1,5 +1,9 @@ | |||
| 1 | var baseClone = require('./_baseClone'); | 1 | var baseClone = require('./_baseClone'); |
| 2 | 2 | ||
| 3 | /** Used to compose bitmasks for cloning. */ | ||
| 4 | var CLONE_DEEP_FLAG = 1, | ||
| 5 | CLONE_SYMBOLS_FLAG = 4; | ||
| 6 | |||
| 3 | /** | 7 | /** |
| 4 | * This method is like `_.clone` except that it recursively clones `value`. | 8 | * This method is like `_.clone` except that it recursively clones `value`. |
| 5 | * | 9 | * |
@@ -19,7 +23,7 @@ | |||
| 19 | * // => false | 23 | * // => false |
| 20 | */ | 24 | */ |
| 21 | function cloneDeep(value) { | 25 | function cloneDeep(value) { |
| 22 | return baseClone(value, true, true); | 26 | return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG); |
| 23 | } | 27 | } |
| 24 | 28 | ||
| 25 | module.exports = cloneDeep; | 29 | module.exports = cloneDeep; |
@@ -1,5 +1,9 @@ | |||
| 1 | var baseClone = require('./_baseClone'); | 1 | var baseClone = require('./_baseClone'); |
| 2 | 2 | ||
| 3 | /** Used to compose bitmasks for cloning. */ | ||
| 4 | var CLONE_DEEP_FLAG = 1, | ||
| 5 | CLONE_SYMBOLS_FLAG = 4; | ||
| 6 | |||
| 3 | /** | 7 | /** |
| 4 | * This method is like `_.cloneWith` except that it recursively clones `value`. | 8 | * This method is like `_.cloneWith` except that it recursively clones `value`. |
| 5 | * | 9 | * |
@@ -30,7 +34,7 @@ | |||
| 30 | */ | 34 | */ |
| 31 | function cloneDeepWith(value, customizer) { | 35 | function cloneDeepWith(value, customizer) { |
| 32 | customizer = typeof customizer == 'function' ? customizer : undefined; | 36 | customizer = typeof customizer == 'function' ? customizer : undefined; |
| 33 | return baseClone(value, true, true, customizer); | 37 | return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer); |
| 34 | } | 38 | } |
| 35 | 39 | ||
| 36 | module.exports = cloneDeepWith; | 40 | module.exports = cloneDeepWith; |
@@ -4,9 +4,9 @@ | |||
| 4 | replaceHolders = require('./_replaceHolders'); | 4 | replaceHolders = require('./_replaceHolders'); |
| 5 | 5 | ||
| 6 | /** Used to compose bitmasks for function metadata. */ | 6 | /** Used to compose bitmasks for function metadata. */ |
| 7 | var BIND_FLAG = 1, | ||
| 8 | BIND_KEY_FLAG = 2, | ||
| 9 | PARTIAL_FLAG = 32; | 7 | var WRAP_BIND_FLAG = 1, |
| 8 | WRAP_BIND_KEY_FLAG = 2, | ||
| 9 | WRAP_PARTIAL_FLAG = 32; | ||
| 10 | 10 | ||
| 11 | /** | 11 | /** |
| 12 | * Creates a function that invokes the method at `object[key]` with `partials` | 12 | * Creates a function that invokes the method at `object[key]` with `partials` |
@@ -54,10 +54,10 @@ | |||
| 54 | * // => 'hiya fred!' | 54 | * // => 'hiya fred!' |
| 55 | */ | 55 | */ |
| 56 | var bindKey = baseRest(function(object, key, partials) { | 56 | var bindKey = baseRest(function(object, key, partials) { |
| 57 | var bitmask = BIND_FLAG | BIND_KEY_FLAG; | 57 | var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG; |
| 58 | if (partials.length) { | 58 | if (partials.length) { |
| 59 | var holders = replaceHolders(partials, getHolder(bindKey)); | 59 | var holders = replaceHolders(partials, getHolder(bindKey)); |
| 60 | bitmask |= PARTIAL_FLAG; | 60 | bitmask |= WRAP_PARTIAL_FLAG; |
| 61 | } | 61 | } |
| 62 | return createWrap(key, bitmask, object, partials, holders); | 62 | return createWrap(key, bitmask, object, partials, holders); |
| 63 | }); | 63 | }); |
@@ -1,5 +1,8 @@ | |||
| 1 | var baseClone = require('./_baseClone'); | 1 | var baseClone = require('./_baseClone'); |
| 2 | 2 | ||
| 3 | /** Used to compose bitmasks for cloning. */ | ||
| 4 | var CLONE_SYMBOLS_FLAG = 4; | ||
| 5 | |||
| 3 | /** | 6 | /** |
| 4 | * This method is like `_.clone` except that it accepts `customizer` which | 7 | * This method is like `_.clone` except that it accepts `customizer` which |
| 5 | * is invoked to produce the cloned value. If `customizer` returns `undefined`, | 8 | * is invoked to produce the cloned value. If `customizer` returns `undefined`, |
@@ -33,7 +36,7 @@ | |||
| 33 | */ | 36 | */ |
| 34 | function cloneWith(value, customizer) { | 37 | function cloneWith(value, customizer) { |
| 35 | customizer = typeof customizer == 'function' ? customizer : undefined; | 38 | customizer = typeof customizer == 'function' ? customizer : undefined; |
| 36 | return baseClone(value, false, true, customizer); | 39 | return baseClone(value, CLONE_SYMBOLS_FLAG, customizer); |
| 37 | } | 40 | } |
| 38 | 41 | ||
| 39 | module.exports = cloneWith; | 42 | module.exports = cloneWith; |
@@ -4,8 +4,8 @@ | |||
| 4 | replaceHolders = require('./_replaceHolders'); | 4 | replaceHolders = require('./_replaceHolders'); |
| 5 | 5 | ||
| 6 | /** Used to compose bitmasks for function metadata. */ | 6 | /** Used to compose bitmasks for function metadata. */ |
| 7 | var BIND_FLAG = 1, | ||
| 8 | PARTIAL_FLAG = 32; | 7 | var WRAP_BIND_FLAG = 1, |
| 8 | WRAP_PARTIAL_FLAG = 32; | ||
| 9 | 9 | ||
| 10 | /** | 10 | /** |
| 11 | * Creates a function that invokes `func` with the `this` binding of `thisArg` | 11 | * Creates a function that invokes `func` with the `this` binding of `thisArg` |
@@ -43,10 +43,10 @@ | |||
| 43 | * // => 'hi fred!' | 43 | * // => 'hi fred!' |
| 44 | */ | 44 | */ |
| 45 | var bind = baseRest(function(func, thisArg, partials) { | 45 | var bind = baseRest(function(func, thisArg, partials) { |
| 46 | var bitmask = BIND_FLAG; | 46 | var bitmask = WRAP_BIND_FLAG; |
| 47 | if (partials.length) { | 47 | if (partials.length) { |
| 48 | var holders = replaceHolders(partials, getHolder(bind)); | 48 | var holders = replaceHolders(partials, getHolder(bind)); |
| 49 | bitmask |= PARTIAL_FLAG; | 49 | bitmask |= WRAP_PARTIAL_FLAG; |
| 50 | } | 50 | } |
| 51 | return createWrap(func, bitmask, thisArg, partials, holders); | 51 | return createWrap(func, bitmask, thisArg, partials, holders); |
| 52 | }); | 52 | }); |
@@ -9,7 +9,7 @@ | |||
| 9 | * @since 1.0.0 | 9 | * @since 1.0.0 |
| 10 | * @category Object | 10 | * @category Object |
| 11 | * @param {Object} object The object to iterate over. | 11 | * @param {Object} object The object to iterate over. |
| 12 | * @param {...(string|string[])} [paths] The property paths of elements to pick. | 12 | * @param {...(string|string[])} [paths] The property paths to pick. |
| 13 | * @returns {Array} Returns the picked values. | 13 | * @returns {Array} Returns the picked values. |
| 14 | * @example | 14 | * @example |
| 15 | * | 15 | * |
@@ -1,6 +1,9 @@ | |||
| 1 | var baseClone = require('./_baseClone'), | 1 | var baseClone = require('./_baseClone'), |
| 2 | baseConforms = require('./_baseConforms'); | 2 | baseConforms = require('./_baseConforms'); |
| 3 | 3 | ||
| 4 | /** Used to compose bitmasks for cloning. */ | ||
| 5 | var CLONE_DEEP_FLAG = 1; | ||
| 6 | |||
| 4 | /** | 7 | /** |
| 5 | * Creates a function that invokes the predicate properties of `source` with | 8 | * Creates a function that invokes the predicate properties of `source` with |
| 6 | * the corresponding property values of a given object, returning `true` if | 9 | * the corresponding property values of a given object, returning `true` if |
@@ -26,7 +29,7 @@ | |||
| 26 | * // => [{ 'a': 1, 'b': 2 }] | 29 | * // => [{ 'a': 1, 'b': 2 }] |
| 27 | */ | 30 | */ |
| 28 | function conforms(source) { | 31 | function conforms(source) { |
| 29 | return baseConforms(baseClone(source, true)); | 32 | return baseConforms(baseClone(source, CLONE_DEEP_FLAG)); |
| 30 | } | 33 | } |
| 31 | 34 | ||
| 32 | module.exports = conforms; | 35 | module.exports = conforms; |
@@ -1,7 +1,7 @@ | |||
| 1 | var createWrap = require('./_createWrap'); | 1 | var createWrap = require('./_createWrap'); |
| 2 | 2 | ||
| 3 | /** Used to compose bitmasks for function metadata. */ | 3 | /** Used to compose bitmasks for function metadata. */ |
| 4 | var ARY_FLAG = 128; | 4 | var WRAP_ARY_FLAG = 128; |
| 5 | 5 | ||
| 6 | /** | 6 | /** |
| 7 | * Creates a function that invokes `func`, with up to `n` arguments, | 7 | * Creates a function that invokes `func`, with up to `n` arguments, |
@@ -23,7 +23,7 @@ | |||
| 23 | function ary(func, n, guard) { | 23 | function ary(func, n, guard) { |
| 24 | n = guard ? undefined : n; | 24 | n = guard ? undefined : n; |
| 25 | n = (func && n == null) ? func.length : n; | 25 | n = (func && n == null) ? func.length : n; |
| 26 | return createWrap(func, ARY_FLAG, undefined, undefined, undefined, undefined, n); | 26 | return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n); |
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | module.exports = ary; | 29 | module.exports = ary; |
@@ -1,7 +1,7 @@ | |||
| 1 | var createWrap = require('./_createWrap'); | 1 | var createWrap = require('./_createWrap'); |
| 2 | 2 | ||
| 3 | /** Used to compose bitmasks for function metadata. */ | 3 | /** Used to compose bitmasks for function metadata. */ |
| 4 | var CURRY_FLAG = 8; | 4 | var WRAP_CURRY_FLAG = 8; |
| 5 | 5 | ||
| 6 | /** | 6 | /** |
| 7 | * Creates a function that accepts arguments of `func` and either invokes | 7 | * Creates a function that accepts arguments of `func` and either invokes |
@@ -46,7 +46,7 @@ | |||
| 46 | */ | 46 | */ |
| 47 | function curry(func, arity, guard) { | 47 | function curry(func, arity, guard) { |
| 48 | arity = guard ? undefined : arity; | 48 | arity = guard ? undefined : arity; |
| 49 | var result = createWrap(func, CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity); | 49 | var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity); |
| 50 | result.placeholder = curry.placeholder; | 50 | result.placeholder = curry.placeholder; |
| 51 | return result; | 51 | return result; |
| 52 | } | 52 | } |
@@ -1,7 +1,7 @@ | |||
| 1 | var createWrap = require('./_createWrap'); | 1 | var createWrap = require('./_createWrap'); |
| 2 | 2 | ||
| 3 | /** Used to compose bitmasks for function metadata. */ | 3 | /** Used to compose bitmasks for function metadata. */ |
| 4 | var CURRY_RIGHT_FLAG = 16; | 4 | var WRAP_CURRY_RIGHT_FLAG = 16; |
| 5 | 5 | ||
| 6 | /** | 6 | /** |
| 7 | * This method is like `_.curry` except that arguments are applied to `func` | 7 | * This method is like `_.curry` except that arguments are applied to `func` |
@@ -43,7 +43,7 @@ | |||
| 43 | */ | 43 | */ |
| 44 | function curryRight(func, arity, guard) { | 44 | function curryRight(func, arity, guard) { |
| 45 | arity = guard ? undefined : arity; | 45 | arity = guard ? undefined : arity; |
| 46 | var result = createWrap(func, CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity); | 46 | var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity); |
| 47 | result.placeholder = curryRight.placeholder; | 47 | result.placeholder = curryRight.placeholder; |
| 48 | return result; | 48 | return result; |
| 49 | } | 49 | } |
@@ -2,27 +2,27 @@ | |||
| 2 | arrayIncludes = require('./_arrayIncludes'); | 2 | arrayIncludes = require('./_arrayIncludes'); |
| 3 | 3 | ||
| 4 | /** Used to compose bitmasks for function metadata. */ | 4 | /** Used to compose bitmasks for function metadata. */ |
| 5 | var BIND_FLAG = 1, | ||
| 6 | BIND_KEY_FLAG = 2, | ||
| 7 | CURRY_FLAG = 8, | ||
| 8 | CURRY_RIGHT_FLAG = 16, | ||
| 9 | PARTIAL_FLAG = 32, | ||
| 10 | PARTIAL_RIGHT_FLAG = 64, | ||
| 11 | ARY_FLAG = 128, | ||
| 12 | REARG_FLAG = 256, | ||
| 13 | FLIP_FLAG = 512; | 5 | var WRAP_BIND_FLAG = 1, |
| 6 | WRAP_BIND_KEY_FLAG = 2, | ||
| 7 | WRAP_CURRY_FLAG = 8, | ||
| 8 | WRAP_CURRY_RIGHT_FLAG = 16, | ||
| 9 | WRAP_PARTIAL_FLAG = 32, | ||
| 10 | WRAP_PARTIAL_RIGHT_FLAG = 64, | ||
| 11 | WRAP_ARY_FLAG = 128, | ||
| 12 | WRAP_REARG_FLAG = 256, | ||
| 13 | WRAP_FLIP_FLAG = 512; | ||
| 14 | 14 | ||
| 15 | /** Used to associate wrap methods with their bit flags. */ | 15 | /** Used to associate wrap methods with their bit flags. */ |
| 16 | var wrapFlags = [ | 16 | var wrapFlags = [ |
| 17 | ['ary', ARY_FLAG], | ||
| 18 | ['bind', BIND_FLAG], | ||
| 19 | ['bindKey', BIND_KEY_FLAG], | ||
| 20 | ['curry', CURRY_FLAG], | ||
| 21 | ['curryRight', CURRY_RIGHT_FLAG], | ||
| 22 | ['flip', FLIP_FLAG], | ||
| 23 | ['partial', PARTIAL_FLAG], | ||
| 24 | ['partialRight', PARTIAL_RIGHT_FLAG], | ||
| 25 | ['rearg', REARG_FLAG] | 17 | ['ary', WRAP_ARY_FLAG], |
| 18 | ['bind', WRAP_BIND_FLAG], | ||
| 19 | ['bindKey', WRAP_BIND_KEY_FLAG], | ||
| 20 | ['curry', WRAP_CURRY_FLAG], | ||
| 21 | ['curryRight', WRAP_CURRY_RIGHT_FLAG], | ||
| 22 | ['flip', WRAP_FLIP_FLAG], | ||
| 23 | ['partial', WRAP_PARTIAL_FLAG], | ||
| 24 | ['partialRight', WRAP_PARTIAL_RIGHT_FLAG], | ||
| 25 | ['rearg', WRAP_REARG_FLAG] | ||
| 26 | ]; | 26 | ]; |
| 27 | 27 | ||
| 28 | /** | 28 | /** |
@@ -1,7 +1,9 @@ | |||
| 1 | /** Used to compose unicode character classes. */ | 1 | /** Used to compose unicode character classes. */ |
| 2 | var rsAstralRange = '\\ud800-\\udfff', | 2 | var rsAstralRange = '\\ud800-\\udfff', |
| 3 | rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23', | ||
| 4 | rsComboSymbolsRange = '\\u20d0-\\u20f0', | 3 | rsComboMarksRange = '\\u0300-\\u036f', |
| 4 | reComboHalfMarksRange = '\\ufe20-\\ufe2f', | ||
| 5 | rsComboSymbolsRange = '\\u20d0-\\u20ff', | ||
| 6 | rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, | ||
| 5 | rsDingbatRange = '\\u2700-\\u27bf', | 7 | rsDingbatRange = '\\u2700-\\u27bf', |
| 6 | rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff', | 8 | rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff', |
| 7 | rsMathOpRange = '\\xac\\xb1\\xd7\\xf7', | 9 | rsMathOpRange = '\\xac\\xb1\\xd7\\xf7', |
@@ -15,7 +17,7 @@ | |||
| 15 | /** Used to compose unicode capture groups. */ | 17 | /** Used to compose unicode capture groups. */ |
| 16 | var rsApos = "['\u2019]", | 18 | var rsApos = "['\u2019]", |
| 17 | rsBreak = '[' + rsBreakRange + ']', | 19 | rsBreak = '[' + rsBreakRange + ']', |
| 18 | rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']', | 20 | rsCombo = '[' + rsComboRange + ']', |
| 19 | rsDigits = '\\d+', | 21 | rsDigits = '\\d+', |
| 20 | rsDingbat = '[' + rsDingbatRange + ']', | 22 | rsDingbat = '[' + rsDingbatRange + ']', |
| 21 | rsLower = '[' + rsLowerRange + ']', | 23 | rsLower = '[' + rsLowerRange + ']', |
@@ -1,12 +1,14 @@ | |||
| 1 | /** Used to compose unicode character classes. */ | 1 | /** Used to compose unicode character classes. */ |
| 2 | var rsAstralRange = '\\ud800-\\udfff', | 2 | var rsAstralRange = '\\ud800-\\udfff', |
| 3 | rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23', | ||
| 4 | rsComboSymbolsRange = '\\u20d0-\\u20f0', | 3 | rsComboMarksRange = '\\u0300-\\u036f', |
| 4 | reComboHalfMarksRange = '\\ufe20-\\ufe2f', | ||
| 5 | rsComboSymbolsRange = '\\u20d0-\\u20ff', | ||
| 6 | rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, | ||
| 5 | rsVarRange = '\\ufe0e\\ufe0f'; | 7 | rsVarRange = '\\ufe0e\\ufe0f'; |
| 6 | 8 | ||
| 7 | /** Used to compose unicode capture groups. */ | 9 | /** Used to compose unicode capture groups. */ |
| 8 | var rsAstral = '[' + rsAstralRange + ']', | 10 | var rsAstral = '[' + rsAstralRange + ']', |
| 9 | rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']', | 11 | rsCombo = '[' + rsComboRange + ']', |
| 10 | rsFitz = '\\ud83c[\\udffb-\\udfff]', | 12 | rsFitz = '\\ud83c[\\udffb-\\udfff]', |
| 11 | rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')', | 13 | rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')', |
| 12 | rsNonAstral = '[^' + rsAstralRange + ']', | 14 | rsNonAstral = '[^' + rsAstralRange + ']', |
@@ -5,11 +5,13 @@ | |||
| 5 | var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g; | 5 | var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g; |
| 6 | 6 | ||
| 7 | /** Used to compose unicode character classes. */ | 7 | /** Used to compose unicode character classes. */ |
| 8 | var rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23', | ||
| 9 | rsComboSymbolsRange = '\\u20d0-\\u20f0'; | 8 | var rsComboMarksRange = '\\u0300-\\u036f', |
| 9 | reComboHalfMarksRange = '\\ufe20-\\ufe2f', | ||
| 10 | rsComboSymbolsRange = '\\u20d0-\\u20ff', | ||
| 11 | rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange; | ||
| 10 | 12 | ||
| 11 | /** Used to compose unicode capture groups. */ | 13 | /** Used to compose unicode capture groups. */ |
| 12 | var rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']'; | 14 | var rsCombo = '[' + rsComboRange + ']'; |
| 13 | 15 | ||
| 14 | /** | 16 | /** |
| 15 | * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and | 17 | * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and |
@@ -1,12 +1,14 @@ | |||
| 1 | /** Used to compose unicode character classes. */ | 1 | /** Used to compose unicode character classes. */ |
| 2 | var rsAstralRange = '\\ud800-\\udfff', | 2 | var rsAstralRange = '\\ud800-\\udfff', |
| 3 | rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23', | ||
| 4 | rsComboSymbolsRange = '\\u20d0-\\u20f0', | 3 | rsComboMarksRange = '\\u0300-\\u036f', |
| 4 | reComboHalfMarksRange = '\\ufe20-\\ufe2f', | ||
| 5 | rsComboSymbolsRange = '\\u20d0-\\u20ff', | ||
| 6 | rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, | ||
| 5 | rsVarRange = '\\ufe0e\\ufe0f'; | 7 | rsVarRange = '\\ufe0e\\ufe0f'; |
| 6 | 8 | ||
| 7 | /** Used to compose unicode capture groups. */ | 9 | /** Used to compose unicode capture groups. */ |
| 8 | var rsAstral = '[' + rsAstralRange + ']', | 10 | var rsAstral = '[' + rsAstralRange + ']', |
| 9 | rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']', | 11 | rsCombo = '[' + rsComboRange + ']', |
| 10 | rsFitz = '\\ud83c[\\udffb-\\udfff]', | 12 | rsFitz = '\\ud83c[\\udffb-\\udfff]', |
| 11 | rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')', | 13 | rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')', |
| 12 | rsNonAstral = '[^' + rsAstralRange + ']', | 14 | rsNonAstral = '[^' + rsAstralRange + ']', |
@@ -15,7 +15,7 @@ | |||
| 15 | /** Used to access faster Node.js helpers. */ | 15 | /** Used to access faster Node.js helpers. */ |
| 16 | var nodeUtil = (function() { | 16 | var nodeUtil = (function() { |
| 17 | try { | 17 | try { |
| 18 | return freeProcess && freeProcess.binding('util'); | 18 | return freeProcess && freeProcess.binding && freeProcess.binding('util'); |
| 19 | } catch (e) {} | 19 | } catch (e) {} |
| 20 | }()); | 20 | }()); |
| 21 | 21 | ||
@@ -1,7 +1,7 @@ | |||
| 1 | var createWrap = require('./_createWrap'); | 1 | var createWrap = require('./_createWrap'); |
| 2 | 2 | ||
| 3 | /** Used to compose bitmasks for function metadata. */ | 3 | /** Used to compose bitmasks for function metadata. */ |
| 4 | var FLIP_FLAG = 512; | 4 | var WRAP_FLIP_FLAG = 512; |
| 5 | 5 | ||
| 6 | /** | 6 | /** |
| 7 | * Creates a function that invokes `func` with arguments reversed. | 7 | * Creates a function that invokes `func` with arguments reversed. |
@@ -22,7 +22,7 @@ | |||
| 22 | * // => ['d', 'c', 'b', 'a'] | 22 | * // => ['d', 'c', 'b', 'a'] |
| 23 | */ | 23 | */ |
| 24 | function flip(func) { | 24 | function flip(func) { |
| 25 | return createWrap(func, FLIP_FLAG); | 25 | return createWrap(func, WRAP_FLIP_FLAG); |
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | module.exports = flip; | 28 | module.exports = flip; |
@@ -6,12 +6,12 @@ | |||
| 6 | var PLACEHOLDER = '__lodash_placeholder__'; | 6 | var PLACEHOLDER = '__lodash_placeholder__'; |
| 7 | 7 | ||
| 8 | /** Used to compose bitmasks for function metadata. */ | 8 | /** Used to compose bitmasks for function metadata. */ |
| 9 | var BIND_FLAG = 1, | ||
| 10 | BIND_KEY_FLAG = 2, | ||
| 11 | CURRY_BOUND_FLAG = 4, | ||
| 12 | CURRY_FLAG = 8, | ||
| 13 | ARY_FLAG = 128, | ||
| 14 | REARG_FLAG = 256; | 9 | var WRAP_BIND_FLAG = 1, |
| 10 | WRAP_BIND_KEY_FLAG = 2, | ||
| 11 | WRAP_CURRY_BOUND_FLAG = 4, | ||
| 12 | WRAP_CURRY_FLAG = 8, | ||
| 13 | WRAP_ARY_FLAG = 128, | ||
| 14 | WRAP_REARG_FLAG = 256; | ||
| 15 | 15 | ||
| 16 | /* Built-in method references for those with the same name as other `lodash` methods. */ | 16 | /* Built-in method references for those with the same name as other `lodash` methods. */ |
| 17 | var nativeMin = Math.min; | 17 | var nativeMin = Math.min; |
@@ -36,22 +36,22 @@ | |||
| 36 | var bitmask = data[1], | 36 | var bitmask = data[1], |
| 37 | srcBitmask = source[1], | 37 | srcBitmask = source[1], |
| 38 | newBitmask = bitmask | srcBitmask, | 38 | newBitmask = bitmask | srcBitmask, |
| 39 | isCommon = newBitmask < (BIND_FLAG | BIND_KEY_FLAG | ARY_FLAG); | 39 | isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG); |
| 40 | 40 | ||
| 41 | var isCombo = | 41 | var isCombo = |
| 42 | ((srcBitmask == ARY_FLAG) && (bitmask == CURRY_FLAG)) || | ||
| 43 | ((srcBitmask == ARY_FLAG) && (bitmask == REARG_FLAG) && (data[7].length <= source[8])) || | ||
| 44 | ((srcBitmask == (ARY_FLAG | REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == CURRY_FLAG)); | 42 | ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) || |
| 43 | ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) || | ||
| 44 | ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG)); | ||
| 45 | 45 | ||
| 46 | // Exit early if metadata can't be merged. | 46 | // Exit early if metadata can't be merged. |
| 47 | if (!(isCommon || isCombo)) { | 47 | if (!(isCommon || isCombo)) { |
| 48 | return data; | 48 | return data; |
| 49 | } | 49 | } |
| 50 | // Use source `thisArg` if available. | 50 | // Use source `thisArg` if available. |
| 51 | if (srcBitmask & BIND_FLAG) { | 51 | if (srcBitmask & WRAP_BIND_FLAG) { |
| 52 | data[2] = source[2]; | 52 | data[2] = source[2]; |
| 53 | // Set when currying a bound function. | 53 | // Set when currying a bound function. |
| 54 | newBitmask |= bitmask & BIND_FLAG ? 0 : CURRY_BOUND_FLAG; | 54 | newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG; |
| 55 | } | 55 | } |
| 56 | // Compose partial arguments. | 56 | // Compose partial arguments. |
| 57 | var value = source[3]; | 57 | var value = source[3]; |
@@ -73,7 +73,7 @@ | |||
| 73 | data[7] = value; | 73 | data[7] = value; |
| 74 | } | 74 | } |
| 75 | // Use source `ary` if it's smaller. | 75 | // Use source `ary` if it's smaller. |
| 76 | if (srcBitmask & ARY_FLAG) { | 76 | if (srcBitmask & WRAP_ARY_FLAG) { |
| 77 | data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]); | 77 | data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]); |
| 78 | } | 78 | } |
| 79 | // Use source `arity` if one is not provided. | 79 | // Use source `arity` if one is not provided. |
@@ -1,14 +1,16 @@ | |||
| 1 | /** Used to compose unicode character classes. */ | 1 | /** Used to compose unicode character classes. */ |
| 2 | var rsAstralRange = '\\ud800-\\udfff', | 2 | var rsAstralRange = '\\ud800-\\udfff', |
| 3 | rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23', | ||
| 4 | rsComboSymbolsRange = '\\u20d0-\\u20f0', | 3 | rsComboMarksRange = '\\u0300-\\u036f', |
| 4 | reComboHalfMarksRange = '\\ufe20-\\ufe2f', | ||
| 5 | rsComboSymbolsRange = '\\u20d0-\\u20ff', | ||
| 6 | rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, | ||
| 5 | rsVarRange = '\\ufe0e\\ufe0f'; | 7 | rsVarRange = '\\ufe0e\\ufe0f'; |
| 6 | 8 | ||
| 7 | /** Used to compose unicode capture groups. */ | 9 | /** Used to compose unicode capture groups. */ |
| 8 | var rsZWJ = '\\u200d'; | 10 | var rsZWJ = '\\u200d'; |
| 9 | 11 | ||
| 10 | /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */ | 12 | /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */ |
| 11 | var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']'); | 13 | var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']'); |
| 12 | 14 | ||
| 13 | /** | 15 | /** |
| 14 | * Checks if `string` contains Unicode symbols. | 16 | * Checks if `string` contains Unicode symbols. |
@@ -7,8 +7,7 @@ | |||
| 7 | var nativeGetSymbols = Object.getOwnPropertySymbols; | 7 | var nativeGetSymbols = Object.getOwnPropertySymbols; |
| 8 | 8 | ||
| 9 | /** | 9 | /** |
| 10 | * Creates an array of the own and inherited enumerable symbol properties | ||
| 11 | * of `object`. | 10 | * Creates an array of the own and inherited enumerable symbols of `object`. |
| 12 | * | 11 | * |
| 13 | * @private | 12 | * @private |
| 14 | * @param {Object} object The object to query. | 13 | * @param {Object} object The object to query. |
@@ -5,7 +5,7 @@ | |||
| 5 | var nativeGetSymbols = Object.getOwnPropertySymbols; | 5 | var nativeGetSymbols = Object.getOwnPropertySymbols; |
| 6 | 6 | ||
| 7 | /** | 7 | /** |
| 8 | * Creates an array of the own enumerable symbol properties of `object`. | 8 | * Creates an array of the own enumerable symbols of `object`. |
| 9 | * | 9 | * |
| 10 | * @private | 10 | * @private |
| 11 | * @param {Object} object The object to query. | 11 | * @param {Object} object The object to query. |
@@ -35,7 +35,7 @@ | |||
| 35 | function isEqualWith(value, other, customizer) { | 35 | function isEqualWith(value, other, customizer) { |
| 36 | customizer = typeof customizer == 'function' ? customizer : undefined; | 36 | customizer = typeof customizer == 'function' ? customizer : undefined; |
| 37 | var result = customizer ? customizer(value, other) : undefined; | 37 | var result = customizer ? customizer(value, other) : undefined; |
| 38 | return result === undefined ? baseIsEqual(value, other, customizer) : !!result; | 38 | return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result; |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | module.exports = isEqualWith; | 41 | module.exports = isEqualWith; |
@@ -2,7 +2,7 @@ | |||
| 2 | isMaskable = require('./_isMaskable'); | 2 | isMaskable = require('./_isMaskable'); |
| 3 | 3 | ||
| 4 | /** Error message constants. */ | 4 | /** Error message constants. */ |
| 5 | var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://github.com/es-shims.'; | 5 | var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.'; |
| 6 | 6 | ||
| 7 | /** | 7 | /** |
| 8 | * Checks if `value` is a pristine native function. | 8 | * Checks if `value` is a pristine native function. |
@@ -1,7 +1,7 @@ | |||
| 1 | var keys = require('./keys'); | 1 | var keys = require('./keys'); |
| 2 | 2 | ||
| 3 | /** Used to compose bitmasks for comparison styles. */ | ||
| 4 | var PARTIAL_COMPARE_FLAG = 2; | 3 | /** Used to compose bitmasks for value comparisons. */ |
| 4 | var COMPARE_PARTIAL_FLAG = 1; | ||
| 5 | 5 | ||
| 6 | /** Used for built-in method references. */ | 6 | /** Used for built-in method references. */ |
| 7 | var objectProto = Object.prototype; | 7 | var objectProto = Object.prototype; |
@@ -16,15 +16,14 @@ | |||
| 16 | * @private | 16 | * @private |
| 17 | * @param {Object} object The object to compare. | 17 | * @param {Object} object The object to compare. |
| 18 | * @param {Object} other The other object to compare. | 18 | * @param {Object} other The other object to compare. |
| 19 | * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. | ||
| 20 | * @param {Function} customizer The function to customize comparisons. | ||
| 19 | * @param {Function} equalFunc The function to determine equivalents of values. | 21 | * @param {Function} equalFunc The function to determine equivalents of values. |
| 20 | * @param {Function} customizer The function to customize comparisons. | ||
| 21 | * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual` | ||
| 22 | * for more details. | ||
| 23 | * @param {Object} stack Tracks traversed `object` and `other` objects. | 22 | * @param {Object} stack Tracks traversed `object` and `other` objects. |
| 24 | * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. | 23 | * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. |
| 25 | */ | 24 | */ |
| 26 | function equalObjects(object, other, equalFunc, customizer, bitmask, stack) { | ||
| 27 | var isPartial = bitmask & PARTIAL_COMPARE_FLAG, | 25 | function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { |
| 26 | var isPartial = bitmask & COMPARE_PARTIAL_FLAG, | ||
| 28 | objProps = keys(object), | 27 | objProps = keys(object), |
| 29 | objLength = objProps.length, | 28 | objLength = objProps.length, |
| 30 | othProps = keys(other), | 29 | othProps = keys(other), |
@@ -62,7 +61,7 @@ | |||
| 62 | } | 61 | } |
| 63 | // Recursively compare objects (susceptible to call stack limits). | 62 | // Recursively compare objects (susceptible to call stack limits). |
| 64 | if (!(compared === undefined | 63 | if (!(compared === undefined |
| 65 | ? (objValue === othValue || equalFunc(objValue, othValue, customizer, bitmask, stack)) | 64 | ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)) |
| 66 | : compared | 65 | : compared |
| 67 | )) { | 66 | )) { |
| 68 | result = false; | 67 | result = false; |
@@ -5,9 +5,9 @@ | |||
| 5 | mapToArray = require('./_mapToArray'), | 5 | mapToArray = require('./_mapToArray'), |
| 6 | setToArray = require('./_setToArray'); | 6 | setToArray = require('./_setToArray'); |
| 7 | 7 | ||
| 8 | /** Used to compose bitmasks for comparison styles. */ | ||
| 9 | var UNORDERED_COMPARE_FLAG = 1, | ||
| 10 | PARTIAL_COMPARE_FLAG = 2; | 8 | /** Used to compose bitmasks for value comparisons. */ |
| 9 | var COMPARE_PARTIAL_FLAG = 1, | ||
| 10 | COMPARE_UNORDERED_FLAG = 2; | ||
| 11 | 11 | ||
| 12 | /** `Object#toString` result references. */ | 12 | /** `Object#toString` result references. */ |
| 13 | var boolTag = '[object Boolean]', | 13 | var boolTag = '[object Boolean]', |
@@ -38,14 +38,13 @@ | |||
| 38 | * @param {Object} object The object to compare. | 38 | * @param {Object} object The object to compare. |
| 39 | * @param {Object} other The other object to compare. | 39 | * @param {Object} other The other object to compare. |
| 40 | * @param {string} tag The `toStringTag` of the objects to compare. | 40 | * @param {string} tag The `toStringTag` of the objects to compare. |
| 41 | * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. | ||
| 42 | * @param {Function} customizer The function to customize comparisons. | ||
| 41 | * @param {Function} equalFunc The function to determine equivalents of values. | 43 | * @param {Function} equalFunc The function to determine equivalents of values. |
| 42 | * @param {Function} customizer The function to customize comparisons. | ||
| 43 | * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual` | ||
| 44 | * for more details. | ||
| 45 | * @param {Object} stack Tracks traversed `object` and `other` objects. | 44 | * @param {Object} stack Tracks traversed `object` and `other` objects. |
| 46 | * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. | 45 | * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. |
| 47 | */ | 46 | */ |
| 48 | function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) { | 47 | function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { |
| 49 | switch (tag) { | 48 | switch (tag) { |
| 50 | case dataViewTag: | 49 | case dataViewTag: |
| 51 | if ((object.byteLength != other.byteLength) || | 50 | if ((object.byteLength != other.byteLength) || |
@@ -83,7 +82,7 @@ | |||
| 83 | var convert = mapToArray; | 82 | var convert = mapToArray; |
| 84 | 83 | ||
| 85 | case setTag: | 84 | case setTag: |
| 86 | var isPartial = bitmask & PARTIAL_COMPARE_FLAG; | 85 | var isPartial = bitmask & COMPARE_PARTIAL_FLAG; |
| 87 | convert || (convert = setToArray); | 86 | convert || (convert = setToArray); |
| 88 | 87 | ||
| 89 | if (object.size != other.size && !isPartial) { | 88 | if (object.size != other.size && !isPartial) { |
@@ -94,11 +93,11 @@ | |||
| 94 | if (stacked) { | 93 | if (stacked) { |
| 95 | return stacked == other; | 94 | return stacked == other; |
| 96 | } | 95 | } |
| 97 | bitmask |= UNORDERED_COMPARE_FLAG; | 96 | bitmask |= COMPARE_UNORDERED_FLAG; |
| 98 | 97 | ||
| 99 | // Recursively compare objects (susceptible to call stack limits). | 98 | // Recursively compare objects (susceptible to call stack limits). |
| 100 | stack.set(object, other); | 99 | stack.set(object, other); |
| 101 | var result = equalArrays(convert(object), convert(other), equalFunc, customizer, bitmask, stack); | 100 | var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack); |
| 102 | stack['delete'](object); | 101 | stack['delete'](object); |
| 103 | return result; | 102 | return result; |
| 104 | 103 | ||
@@ -2,9 +2,9 @@ | |||
| 2 | arraySome = require('./_arraySome'), | 2 | arraySome = require('./_arraySome'), |
| 3 | cacheHas = require('./_cacheHas'); | 3 | cacheHas = require('./_cacheHas'); |
| 4 | 4 | ||
| 5 | /** Used to compose bitmasks for comparison styles. */ | ||
| 6 | var UNORDERED_COMPARE_FLAG = 1, | ||
| 7 | PARTIAL_COMPARE_FLAG = 2; | 5 | /** Used to compose bitmasks for value comparisons. */ |
| 6 | var COMPARE_PARTIAL_FLAG = 1, | ||
| 7 | COMPARE_UNORDERED_FLAG = 2; | ||
| 8 | 8 | ||
| 9 | /** | 9 | /** |
| 10 | * A specialized version of `baseIsEqualDeep` for arrays with support for | 10 | * A specialized version of `baseIsEqualDeep` for arrays with support for |
@@ -13,15 +13,14 @@ | |||
| 13 | * @private | 13 | * @private |
| 14 | * @param {Array} array The array to compare. | 14 | * @param {Array} array The array to compare. |
| 15 | * @param {Array} other The other array to compare. | 15 | * @param {Array} other The other array to compare. |
| 16 | * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. | ||
| 17 | * @param {Function} customizer The function to customize comparisons. | ||
| 16 | * @param {Function} equalFunc The function to determine equivalents of values. | 18 | * @param {Function} equalFunc The function to determine equivalents of values. |
| 17 | * @param {Function} customizer The function to customize comparisons. | ||
| 18 | * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual` | ||
| 19 | * for more details. | ||
| 20 | * @param {Object} stack Tracks traversed `array` and `other` objects. | 19 | * @param {Object} stack Tracks traversed `array` and `other` objects. |
| 21 | * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. | 20 | * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. |
| 22 | */ | 21 | */ |
| 23 | function equalArrays(array, other, equalFunc, customizer, bitmask, stack) { | ||
| 24 | var isPartial = bitmask & PARTIAL_COMPARE_FLAG, | 22 | function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { |
| 23 | var isPartial = bitmask & COMPARE_PARTIAL_FLAG, | ||
| 25 | arrLength = array.length, | 24 | arrLength = array.length, |
| 26 | othLength = other.length; | 25 | othLength = other.length; |
| 27 | 26 | ||
@@ -35,7 +34,7 @@ | |||
| 35 | } | 34 | } |
| 36 | var index = -1, | 35 | var index = -1, |
| 37 | result = true, | 36 | result = true, |
| 38 | seen = (bitmask & UNORDERED_COMPARE_FLAG) ? new SetCache : undefined; | 37 | seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined; |
| 39 | 38 | ||
| 40 | stack.set(array, other); | 39 | stack.set(array, other); |
| 41 | stack.set(other, array); | 40 | stack.set(other, array); |
@@ -61,7 +60,7 @@ | |||
| 61 | if (seen) { | 60 | if (seen) { |
| 62 | if (!arraySome(other, function(othValue, othIndex) { | 61 | if (!arraySome(other, function(othValue, othIndex) { |
| 63 | if (!cacheHas(seen, othIndex) && | 62 | if (!cacheHas(seen, othIndex) && |
| 64 | (arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) { | 63 | (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { |
| 65 | return seen.push(othIndex); | 64 | return seen.push(othIndex); |
| 66 | } | 65 | } |
| 67 | })) { | 66 | })) { |
@@ -70,7 +69,7 @@ | |||
| 70 | } | 69 | } |
| 71 | } else if (!( | 70 | } else if (!( |
| 72 | arrValue === othValue || | 71 | arrValue === othValue || |
| 73 | equalFunc(arrValue, othValue, customizer, bitmask, stack) | 72 | equalFunc(arrValue, othValue, bitmask, customizer, stack) |
| 74 | )) { | 73 | )) { |
| 75 | result = false; | 74 | result = false; |
| 76 | break; | 75 | break; |
@@ -13,12 +13,12 @@ | |||
| 13 | var FUNC_ERROR_TEXT = 'Expected a function'; | 13 | var FUNC_ERROR_TEXT = 'Expected a function'; |
| 14 | 14 | ||
| 15 | /** Used to compose bitmasks for function metadata. */ | 15 | /** Used to compose bitmasks for function metadata. */ |
| 16 | var BIND_FLAG = 1, | ||
| 17 | BIND_KEY_FLAG = 2, | ||
| 18 | CURRY_FLAG = 8, | ||
| 19 | CURRY_RIGHT_FLAG = 16, | ||
| 20 | PARTIAL_FLAG = 32, | ||
| 21 | PARTIAL_RIGHT_FLAG = 64; | 16 | var WRAP_BIND_FLAG = 1, |
| 17 | WRAP_BIND_KEY_FLAG = 2, | ||
| 18 | WRAP_CURRY_FLAG = 8, | ||
| 19 | WRAP_CURRY_RIGHT_FLAG = 16, | ||
| 20 | WRAP_PARTIAL_FLAG = 32, | ||
| 21 | WRAP_PARTIAL_RIGHT_FLAG = 64; | ||
| 22 | 22 | ||
| 23 | /* Built-in method references for those with the same name as other `lodash` methods. */ | 23 | /* Built-in method references for those with the same name as other `lodash` methods. */ |
| 24 | var nativeMax = Math.max; | 24 | var nativeMax = Math.max; |
@@ -30,17 +30,16 @@ | |||
| 30 | * @private | 30 | * @private |
| 31 | * @param {Function|string} func The function or method name to wrap. | 31 | * @param {Function|string} func The function or method name to wrap. |
| 32 | * @param {number} bitmask The bitmask flags. | 32 | * @param {number} bitmask The bitmask flags. |
| 33 | * The bitmask may be composed of the following flags: | ||
| 34 | * 1 - `_.bind` | ||
| 35 | * 2 - `_.bindKey` | ||
| 36 | * 4 - `_.curry` or `_.curryRight` of a bound function | ||
| 37 | * 8 - `_.curry` | ||
| 38 | * 16 - `_.curryRight` | ||
| 39 | * 32 - `_.partial` | ||
| 40 | * 64 - `_.partialRight` | ||
| 41 | * 128 - `_.rearg` | ||
| 42 | * 256 - `_.ary` | ||
| 43 | * 512 - `_.flip` | 33 | * 1 - `_.bind` |
| 34 | * 2 - `_.bindKey` | ||
| 35 | * 4 - `_.curry` or `_.curryRight` of a bound function | ||
| 36 | * 8 - `_.curry` | ||
| 37 | * 16 - `_.curryRight` | ||
| 38 | * 32 - `_.partial` | ||
| 39 | * 64 - `_.partialRight` | ||
| 40 | * 128 - `_.rearg` | ||
| 41 | * 256 - `_.ary` | ||
| 42 | * 512 - `_.flip` | ||
| 44 | * @param {*} [thisArg] The `this` binding of `func`. | 43 | * @param {*} [thisArg] The `this` binding of `func`. |
| 45 | * @param {Array} [partials] The arguments to be partially applied. | 44 | * @param {Array} [partials] The arguments to be partially applied. |
| 46 | * @param {Array} [holders] The `partials` placeholder indexes. | 45 | * @param {Array} [holders] The `partials` placeholder indexes. |
@@ -50,20 +49,20 @@ | |||
| 50 | * @returns {Function} Returns the new wrapped function. | 49 | * @returns {Function} Returns the new wrapped function. |
| 51 | */ | 50 | */ |
| 52 | function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) { | 51 | function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) { |
| 53 | var isBindKey = bitmask & BIND_KEY_FLAG; | 52 | var isBindKey = bitmask & WRAP_BIND_KEY_FLAG; |
| 54 | if (!isBindKey && typeof func != 'function') { | 53 | if (!isBindKey && typeof func != 'function') { |
| 55 | throw new TypeError(FUNC_ERROR_TEXT); | 54 | throw new TypeError(FUNC_ERROR_TEXT); |
| 56 | } | 55 | } |
| 57 | var length = partials ? partials.length : 0; | 56 | var length = partials ? partials.length : 0; |
| 58 | if (!length) { | 57 | if (!length) { |
| 59 | bitmask &= ~(PARTIAL_FLAG | PARTIAL_RIGHT_FLAG); | 58 | bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG); |
| 60 | partials = holders = undefined; | 59 | partials = holders = undefined; |
| 61 | } | 60 | } |
| 62 | ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0); | 61 | ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0); |
| 63 | arity = arity === undefined ? arity : toInteger(arity); | 62 | arity = arity === undefined ? arity : toInteger(arity); |
| 64 | length -= holders ? holders.length : 0; | 63 | length -= holders ? holders.length : 0; |
| 65 | 64 | ||
| 66 | if (bitmask & PARTIAL_RIGHT_FLAG) { | 65 | if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) { |
| 67 | var partialsRight = partials, | 66 | var partialsRight = partials, |
| 68 | holdersRight = holders; | 67 | holdersRight = holders; |
| 69 | 68 | ||
@@ -88,14 +87,14 @@ | |||
| 88 | ? (isBindKey ? 0 : func.length) | 87 | ? (isBindKey ? 0 : func.length) |
| 89 | : nativeMax(newData[9] - length, 0); | 88 | : nativeMax(newData[9] - length, 0); |
| 90 | 89 | ||
| 91 | if (!arity && bitmask & (CURRY_FLAG | CURRY_RIGHT_FLAG)) { | ||
| 92 | bitmask &= ~(CURRY_FLAG | CURRY_RIGHT_FLAG); | 90 | if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) { |
| 91 | bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG); | ||
| 93 | } | 92 | } |
| 94 | if (!bitmask || bitmask == BIND_FLAG) { | 93 | if (!bitmask || bitmask == WRAP_BIND_FLAG) { |
| 95 | var result = createBind(func, bitmask, thisArg); | 94 | var result = createBind(func, bitmask, thisArg); |
| 96 | } else if (bitmask == CURRY_FLAG || bitmask == CURRY_RIGHT_FLAG) { | 95 | } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) { |
| 97 | result = createCurry(func, bitmask, arity); | 96 | result = createCurry(func, bitmask, arity); |
| 98 | } else if ((bitmask == PARTIAL_FLAG || bitmask == (BIND_FLAG | PARTIAL_FLAG)) && !holders.length) { | 97 | } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) { |
| 99 | result = createPartial(func, bitmask, thisArg, partials); | 98 | result = createPartial(func, bitmask, thisArg, partials); |
| 100 | } else { | 99 | } else { |
| 101 | result = createHybrid.apply(undefined, newData); | 100 | result = createHybrid.apply(undefined, newData); |
@@ -3,12 +3,12 @@ | |||
| 3 | setWrapToString = require('./_setWrapToString'); | 3 | setWrapToString = require('./_setWrapToString'); |
| 4 | 4 | ||
| 5 | /** Used to compose bitmasks for function metadata. */ | 5 | /** Used to compose bitmasks for function metadata. */ |
| 6 | var BIND_FLAG = 1, | ||
| 7 | BIND_KEY_FLAG = 2, | ||
| 8 | CURRY_BOUND_FLAG = 4, | ||
| 9 | CURRY_FLAG = 8, | ||
| 10 | PARTIAL_FLAG = 32, | ||
| 11 | PARTIAL_RIGHT_FLAG = 64; | 6 | var WRAP_BIND_FLAG = 1, |
| 7 | WRAP_BIND_KEY_FLAG = 2, | ||
| 8 | WRAP_CURRY_BOUND_FLAG = 4, | ||
| 9 | WRAP_CURRY_FLAG = 8, | ||
| 10 | WRAP_PARTIAL_FLAG = 32, | ||
| 11 | WRAP_PARTIAL_RIGHT_FLAG = 64; | ||
| 12 | 12 | ||
| 13 | /** | 13 | /** |
| 14 | * Creates a function that wraps `func` to continue currying. | 14 | * Creates a function that wraps `func` to continue currying. |
@@ -28,17 +28,17 @@ | |||
| 28 | * @returns {Function} Returns the new wrapped function. | 28 | * @returns {Function} Returns the new wrapped function. |
| 29 | */ | 29 | */ |
| 30 | function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) { | 30 | function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) { |
| 31 | var isCurry = bitmask & CURRY_FLAG, | 31 | var isCurry = bitmask & WRAP_CURRY_FLAG, |
| 32 | newHolders = isCurry ? holders : undefined, | 32 | newHolders = isCurry ? holders : undefined, |
| 33 | newHoldersRight = isCurry ? undefined : holders, | 33 | newHoldersRight = isCurry ? undefined : holders, |
| 34 | newPartials = isCurry ? partials : undefined, | 34 | newPartials = isCurry ? partials : undefined, |
| 35 | newPartialsRight = isCurry ? undefined : partials; | 35 | newPartialsRight = isCurry ? undefined : partials; |
| 36 | 36 | ||
| 37 | bitmask |= (isCurry ? PARTIAL_FLAG : PARTIAL_RIGHT_FLAG); | ||
| 38 | bitmask &= ~(isCurry ? PARTIAL_RIGHT_FLAG : PARTIAL_FLAG); | 37 | bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG); |
| 38 | bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG); | ||
| 39 | 39 | ||
| 40 | if (!(bitmask & CURRY_BOUND_FLAG)) { | ||
| 41 | bitmask &= ~(BIND_FLAG | BIND_KEY_FLAG); | 40 | if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) { |
| 41 | bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG); | ||
| 42 | } | 42 | } |
| 43 | var newData = [ | 43 | var newData = [ |
| 44 | func, bitmask, thisArg, newPartials, newHolders, newPartialsRight, | 44 | func, bitmask, thisArg, newPartials, newHolders, newPartialsRight, |
@@ -3,7 +3,7 @@ | |||
| 3 | root = require('./_root'); | 3 | root = require('./_root'); |
| 4 | 4 | ||
| 5 | /** Used to compose bitmasks for function metadata. */ | 5 | /** Used to compose bitmasks for function metadata. */ |
| 6 | var BIND_FLAG = 1; | 6 | var WRAP_BIND_FLAG = 1; |
| 7 | 7 | ||
| 8 | /** | 8 | /** |
| 9 | * Creates a function that wraps `func` to invoke it with the `this` binding | 9 | * Creates a function that wraps `func` to invoke it with the `this` binding |
@@ -18,7 +18,7 @@ | |||
| 18 | * @returns {Function} Returns the new wrapped function. | 18 | * @returns {Function} Returns the new wrapped function. |
| 19 | */ | 19 | */ |
| 20 | function createPartial(func, bitmask, thisArg, partials) { | 20 | function createPartial(func, bitmask, thisArg, partials) { |
| 21 | var isBind = bitmask & BIND_FLAG, | 21 | var isBind = bitmask & WRAP_BIND_FLAG, |
| 22 | Ctor = createCtor(func); | 22 | Ctor = createCtor(func); |
| 23 | 23 | ||
| 24 | function wrapper() { | 24 | function wrapper() { |
@@ -1,6 +1,9 @@ | |||
| 1 | var baseClone = require('./_baseClone'), | 1 | var baseClone = require('./_baseClone'), |
| 2 | baseIteratee = require('./_baseIteratee'); | 2 | baseIteratee = require('./_baseIteratee'); |
| 3 | 3 | ||
| 4 | /** Used to compose bitmasks for cloning. */ | ||
| 5 | var CLONE_DEEP_FLAG = 1; | ||
| 6 | |||
| 4 | /** | 7 | /** |
| 5 | * Creates a function that invokes `func` with the arguments of the created | 8 | * Creates a function that invokes `func` with the arguments of the created |
| 6 | * function. If `func` is a property name, the created function returns the | 9 | * function. If `func` is a property name, the created function returns the |
@@ -44,7 +47,7 @@ | |||
| 44 | * // => ['def'] | 47 | * // => ['def'] |
| 45 | */ | 48 | */ |
| 46 | function iteratee(func) { | 49 | function iteratee(func) { |
| 47 | return baseIteratee(typeof func == 'function' ? func : baseClone(func, true)); | 50 | return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG)); |
| 48 | } | 51 | } |
| 49 | 52 | ||
| 50 | module.exports = iteratee; | 53 | module.exports = iteratee; |
@@ -9,12 +9,12 @@ | |||
| 9 | root = require('./_root'); | 9 | root = require('./_root'); |
| 10 | 10 | ||
| 11 | /** Used to compose bitmasks for function metadata. */ | 11 | /** Used to compose bitmasks for function metadata. */ |
| 12 | var BIND_FLAG = 1, | ||
| 13 | BIND_KEY_FLAG = 2, | ||
| 14 | CURRY_FLAG = 8, | ||
| 15 | CURRY_RIGHT_FLAG = 16, | ||
| 16 | ARY_FLAG = 128, | ||
| 17 | FLIP_FLAG = 512; | 12 | var WRAP_BIND_FLAG = 1, |
| 13 | WRAP_BIND_KEY_FLAG = 2, | ||
| 14 | WRAP_CURRY_FLAG = 8, | ||
| 15 | WRAP_CURRY_RIGHT_FLAG = 16, | ||
| 16 | WRAP_ARY_FLAG = 128, | ||
| 17 | WRAP_FLIP_FLAG = 512; | ||
| 18 | 18 | ||
| 19 | /** | 19 | /** |
| 20 | * Creates a function that wraps `func` to invoke it with optional `this` | 20 | * Creates a function that wraps `func` to invoke it with optional `this` |
@@ -36,11 +36,11 @@ | |||
| 36 | * @returns {Function} Returns the new wrapped function. | 36 | * @returns {Function} Returns the new wrapped function. |
| 37 | */ | 37 | */ |
| 38 | function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) { | 38 | function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) { |
| 39 | var isAry = bitmask & ARY_FLAG, | ||
| 40 | isBind = bitmask & BIND_FLAG, | ||
| 41 | isBindKey = bitmask & BIND_KEY_FLAG, | ||
| 42 | isCurried = bitmask & (CURRY_FLAG | CURRY_RIGHT_FLAG), | ||
| 43 | isFlip = bitmask & FLIP_FLAG, | 39 | var isAry = bitmask & WRAP_ARY_FLAG, |
| 40 | isBind = bitmask & WRAP_BIND_FLAG, | ||
| 41 | isBindKey = bitmask & WRAP_BIND_KEY_FLAG, | ||
| 42 | isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG), | ||
| 43 | isFlip = bitmask & WRAP_FLIP_FLAG, | ||
| 44 | Ctor = isBindKey ? undefined : createCtor(func); | 44 | Ctor = isBindKey ? undefined : createCtor(func); |
| 45 | 45 | ||
| 46 | function wrapper() { | 46 | function wrapper() { |
@@ -12,10 +12,10 @@ | |||
| 12 | var FUNC_ERROR_TEXT = 'Expected a function'; | 12 | var FUNC_ERROR_TEXT = 'Expected a function'; |
| 13 | 13 | ||
| 14 | /** Used to compose bitmasks for function metadata. */ | 14 | /** Used to compose bitmasks for function metadata. */ |
| 15 | var CURRY_FLAG = 8, | ||
| 16 | PARTIAL_FLAG = 32, | ||
| 17 | ARY_FLAG = 128, | ||
| 18 | REARG_FLAG = 256; | 15 | var WRAP_CURRY_FLAG = 8, |
| 16 | WRAP_PARTIAL_FLAG = 32, | ||
| 17 | WRAP_ARY_FLAG = 128, | ||
| 18 | WRAP_REARG_FLAG = 256; | ||
| 19 | 19 | ||
| 20 | /** | 20 | /** |
| 21 | * Creates a `_.flow` or `_.flowRight` function. | 21 | * Creates a `_.flow` or `_.flowRight` function. |
@@ -50,7 +50,7 @@ | |||
| 50 | data = funcName == 'wrapper' ? getData(func) : undefined; | 50 | data = funcName == 'wrapper' ? getData(func) : undefined; |
| 51 | 51 | ||
| 52 | if (data && isLaziable(data[0]) && | 52 | if (data && isLaziable(data[0]) && |
| 53 | data[1] == (ARY_FLAG | CURRY_FLAG | PARTIAL_FLAG | REARG_FLAG) && | 53 | data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) && |
| 54 | !data[4].length && data[9] == 1 | 54 | !data[4].length && data[9] == 1 |
| 55 | ) { | 55 | ) { |
| 56 | wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]); | 56 | wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]); |
@@ -2,7 +2,7 @@ | |||
| 2 | root = require('./_root'); | 2 | root = require('./_root'); |
| 3 | 3 | ||
| 4 | /** Used to compose bitmasks for function metadata. */ | 4 | /** Used to compose bitmasks for function metadata. */ |
| 5 | var BIND_FLAG = 1; | 5 | var WRAP_BIND_FLAG = 1; |
| 6 | 6 | ||
| 7 | /** | 7 | /** |
| 8 | * Creates a function that wraps `func` to invoke it with the optional `this` | 8 | * Creates a function that wraps `func` to invoke it with the optional `this` |
@@ -15,7 +15,7 @@ | |||
| 15 | * @returns {Function} Returns the new wrapped function. | 15 | * @returns {Function} Returns the new wrapped function. |
| 16 | */ | 16 | */ |
| 17 | function createBind(func, bitmask, thisArg) { | 17 | function createBind(func, bitmask, thisArg) { |
| 18 | var isBind = bitmask & BIND_FLAG, | 18 | var isBind = bitmask & WRAP_BIND_FLAG, |
| 19 | Ctor = createCtor(func); | 19 | Ctor = createCtor(func); |
| 20 | 20 | ||
| 21 | function wrapper() { | 21 | function wrapper() { |
@@ -1,6 +1,9 @@ | |||
| 1 | var baseClone = require('./_baseClone'), | 1 | var baseClone = require('./_baseClone'), |
| 2 | baseMatches = require('./_baseMatches'); | 2 | baseMatches = require('./_baseMatches'); |
| 3 | 3 | ||
| 4 | /** Used to compose bitmasks for cloning. */ | ||
| 5 | var CLONE_DEEP_FLAG = 1; | ||
| 6 | |||
| 4 | /** | 7 | /** |
| 5 | * Creates a function that performs a partial deep comparison between a given | 8 | * Creates a function that performs a partial deep comparison between a given |
| 6 | * object and `source`, returning `true` if the given object has equivalent | 9 | * object and `source`, returning `true` if the given object has equivalent |
@@ -30,7 +33,7 @@ | |||
| 30 | * // => [{ 'a': 4, 'b': 5, 'c': 6 }] | 33 | * // => [{ 'a': 4, 'b': 5, 'c': 6 }] |
| 31 | */ | 34 | */ |
| 32 | function matches(source) { | 35 | function matches(source) { |
| 33 | return baseMatches(baseClone(source, true)); | 36 | return baseMatches(baseClone(source, CLONE_DEEP_FLAG)); |
| 34 | } | 37 | } |
| 35 | 38 | ||
| 36 | module.exports = matches; | 39 | module.exports = matches; |
@@ -2,7 +2,7 @@ | |||
| 2 | getSymbols = require('./_getSymbols'); | 2 | getSymbols = require('./_getSymbols'); |
| 3 | 3 | ||
| 4 | /** | 4 | /** |
| 5 | * Copies own symbol properties of `source` to `object`. | 5 | * Copies own symbols of `source` to `object`. |
| 6 | * | 6 | * |
| 7 | * @private | 7 | * @private |
| 8 | * @param {Object} source The object to copy symbols from. | 8 | * @param {Object} source The object to copy symbols from. |
@@ -1,6 +1,9 @@ | |||
| 1 | var baseClone = require('./_baseClone'), | 1 | var baseClone = require('./_baseClone'), |
| 2 | baseMatchesProperty = require('./_baseMatchesProperty'); | 2 | baseMatchesProperty = require('./_baseMatchesProperty'); |
| 3 | 3 | ||
| 4 | /** Used to compose bitmasks for cloning. */ | ||
| 5 | var CLONE_DEEP_FLAG = 1; | ||
| 6 | |||
| 4 | /** | 7 | /** |
| 5 | * Creates a function that performs a partial deep comparison between the | 8 | * Creates a function that performs a partial deep comparison between the |
| 6 | * value at `path` of a given object to `srcValue`, returning `true` if the | 9 | * value at `path` of a given object to `srcValue`, returning `true` if the |
@@ -28,7 +31,7 @@ | |||
| 28 | * // => { 'a': 4, 'b': 5, 'c': 6 } | 31 | * // => { 'a': 4, 'b': 5, 'c': 6 } |
| 29 | */ | 32 | */ |
| 30 | function matchesProperty(path, srcValue) { | 33 | function matchesProperty(path, srcValue) { |
| 31 | return baseMatchesProperty(path, baseClone(srcValue, true)); | 34 | return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG)); |
| 32 | } | 35 | } |
| 33 | 36 | ||
| 34 | module.exports = matchesProperty; | 37 | module.exports = matchesProperty; |
@@ -2,6 +2,9 @@ | |||
| 2 | arrayReduce = require('./_arrayReduce'), | 2 | arrayReduce = require('./_arrayReduce'), |
| 3 | setToArray = require('./_setToArray'); | 3 | setToArray = require('./_setToArray'); |
| 4 | 4 | ||
| 5 | /** Used to compose bitmasks for cloning. */ | ||
| 6 | var CLONE_DEEP_FLAG = 1; | ||
| 7 | |||
| 5 | /** | 8 | /** |
| 6 | * Creates a clone of `set`. | 9 | * Creates a clone of `set`. |
| 7 | * | 10 | * |
@@ -12,7 +15,7 @@ | |||
| 12 | * @returns {Object} Returns the cloned set. | 15 | * @returns {Object} Returns the cloned set. |
| 13 | */ | 16 | */ |
| 14 | function cloneSet(set, isDeep, cloneFunc) { | 17 | function cloneSet(set, isDeep, cloneFunc) { |
| 15 | var array = isDeep ? cloneFunc(setToArray(set), true) : setToArray(set); | 18 | var array = isDeep ? cloneFunc(setToArray(set), CLONE_DEEP_FLAG) : setToArray(set); |
| 16 | return arrayReduce(array, addSetEntry, new set.constructor); | 19 | return arrayReduce(array, addSetEntry, new set.constructor); |
| 17 | } | 20 | } |
| 18 | 21 | ||
@@ -2,6 +2,9 @@ | |||
| 2 | arrayReduce = require('./_arrayReduce'), | 2 | arrayReduce = require('./_arrayReduce'), |
| 3 | mapToArray = require('./_mapToArray'); | 3 | mapToArray = require('./_mapToArray'); |
| 4 | 4 | ||
| 5 | /** Used to compose bitmasks for cloning. */ | ||
| 6 | var CLONE_DEEP_FLAG = 1; | ||
| 7 | |||
| 5 | /** | 8 | /** |
| 6 | * Creates a clone of `map`. | 9 | * Creates a clone of `map`. |
| 7 | * | 10 | * |
@@ -12,7 +15,7 @@ | |||
| 12 | * @returns {Object} Returns the cloned map. | 15 | * @returns {Object} Returns the cloned map. |
| 13 | */ | 16 | */ |
| 14 | function cloneMap(map, isDeep, cloneFunc) { | 17 | function cloneMap(map, isDeep, cloneFunc) { |
| 15 | var array = isDeep ? cloneFunc(mapToArray(map), true) : mapToArray(map); | 18 | var array = isDeep ? cloneFunc(mapToArray(map), CLONE_DEEP_FLAG) : mapToArray(map); |
| 16 | return arrayReduce(array, addMapEntry, new map.constructor); | 19 | return arrayReduce(array, addMapEntry, new map.constructor); |
| 17 | } | 20 | } |
| 18 | 21 | ||
@@ -1,21 +1,26 @@ | |||
| 1 | var arrayMap = require('./_arrayMap'), | ||
| 2 | baseDifference = require('./_baseDifference'), | ||
| 3 | basePick = require('./_basePick'), | 1 | var baseClone = require('./_baseClone'), |
| 2 | baseUnset = require('./_baseUnset'), | ||
| 3 | copyObject = require('./_copyObject'), | ||
| 4 | flatRest = require('./_flatRest'), | 4 | flatRest = require('./_flatRest'), |
| 5 | getAllKeysIn = require('./_getAllKeysIn'), | ||
| 6 | toKey = require('./_toKey'); | 5 | getAllKeysIn = require('./_getAllKeysIn'); |
| 7 | 6 | ||
| 7 | /** Used to compose bitmasks for cloning. */ | ||
| 8 | var CLONE_DEEP_FLAG = 1, | ||
| 9 | CLONE_FLAT_FLAG = 2, | ||
| 10 | CLONE_SYMBOLS_FLAG = 4; | ||
| 11 | |||
| 8 | /** | 12 | /** |
| 9 | * The opposite of `_.pick`; this method creates an object composed of the | 13 | * The opposite of `_.pick`; this method creates an object composed of the |
| 10 | * own and inherited enumerable string keyed properties of `object` that are | ||
| 11 | * not omitted. | 14 | * own and inherited enumerable property paths of `object` that are not omitted. |
| 12 | * | 15 | * |
| 16 | * **Note:** This method is considerably slower than `_.pick`. | ||
| 17 | * | ||
| 13 | * @static | 18 | * @static |
| 14 | * @since 0.1.0 | 19 | * @since 0.1.0 |
| 15 | * @memberOf _ | 20 | * @memberOf _ |
| 16 | * @category Object | 21 | * @category Object |
| 17 | * @param {Object} object The source object. | 22 | * @param {Object} object The source object. |
| 18 | * @param {...(string|string[])} [props] The property identifiers to omit. | 23 | * @param {...(string|string[])} [paths] The property paths to omit. |
| 19 | * @returns {Object} Returns the new object. | 24 | * @returns {Object} Returns the new object. |
| 20 | * @example | 25 | * @example |
| 21 | * | 26 | * |
@@ -24,12 +29,19 @@ | |||
| 24 | * _.omit(object, ['a', 'c']); | 29 | * _.omit(object, ['a', 'c']); |
| 25 | * // => { 'b': '2' } | 30 | * // => { 'b': '2' } |
| 26 | */ | 31 | */ |
| 27 | var omit = flatRest(function(object, props) { | 32 | var omit = flatRest(function(object, paths) { |
| 33 | var result = {}; | ||
| 28 | if (object == null) { | 34 | if (object == null) { |
| 29 | return {}; | 35 | return result; |
| 30 | } | 36 | } |
| 31 | props = arrayMap(props, toKey); | ||
| 32 | return basePick(object, baseDifference(getAllKeysIn(object), props)); | 37 | copyObject(object, getAllKeysIn(object), result); |
| 38 | result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG); | ||
| 39 | |||
| 40 | var length = paths.length; | ||
| 41 | while (length--) { | ||
| 42 | baseUnset(result, paths[length]); | ||
| 43 | } | ||
| 44 | return result; | ||
| 33 | }); | 45 | }); |
| 34 | 46 | ||
| 35 | module.exports = omit; | 47 | module.exports = omit; |
@@ -15,7 +15,7 @@ | |||
| 15 | * | 15 | * |
| 16 | * @private | 16 | * @private |
| 17 | * @param {Object} object The object to modify. | 17 | * @param {Object} object The object to modify. |
| 18 | * @param {Array|string} path The path of the property to unset. | 18 | * @param {Array|string} path The property path to unset. |
| 19 | * @returns {boolean} Returns `true` if the property is deleted, else `false`. | 19 | * @returns {boolean} Returns `true` if the property is deleted, else `false`. |
| 20 | */ | 20 | */ |
| 21 | function baseUnset(object, path) { | 21 | function baseUnset(object, path) { |
@@ -4,7 +4,7 @@ | |||
| 4 | replaceHolders = require('./_replaceHolders'); | 4 | replaceHolders = require('./_replaceHolders'); |
| 5 | 5 | ||
| 6 | /** Used to compose bitmasks for function metadata. */ | 6 | /** Used to compose bitmasks for function metadata. */ |
| 7 | var PARTIAL_FLAG = 32; | 7 | var WRAP_PARTIAL_FLAG = 32; |
| 8 | 8 | ||
| 9 | /** | 9 | /** |
| 10 | * Creates a function that invokes `func` with `partials` prepended to the | 10 | * Creates a function that invokes `func` with `partials` prepended to the |
@@ -41,7 +41,7 @@ | |||
| 41 | */ | 41 | */ |
| 42 | var partial = baseRest(function(func, partials) { | 42 | var partial = baseRest(function(func, partials) { |
| 43 | var holders = replaceHolders(partials, getHolder(partial)); | 43 | var holders = replaceHolders(partials, getHolder(partial)); |
| 44 | return createWrap(func, PARTIAL_FLAG, undefined, partials, holders); | 44 | return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders); |
| 45 | }); | 45 | }); |
| 46 | 46 | ||
| 47 | // Assign default placeholders. | 47 | // Assign default placeholders. |
@@ -4,7 +4,7 @@ | |||
| 4 | replaceHolders = require('./_replaceHolders'); | 4 | replaceHolders = require('./_replaceHolders'); |
| 5 | 5 | ||
| 6 | /** Used to compose bitmasks for function metadata. */ | 6 | /** Used to compose bitmasks for function metadata. */ |
| 7 | var PARTIAL_RIGHT_FLAG = 64; | 7 | var WRAP_PARTIAL_RIGHT_FLAG = 64; |
| 8 | 8 | ||
| 9 | /** | 9 | /** |
| 10 | * This method is like `_.partial` except that partially applied arguments | 10 | * This method is like `_.partial` except that partially applied arguments |
@@ -40,7 +40,7 @@ | |||
| 40 | */ | 40 | */ |
| 41 | var partialRight = baseRest(function(func, partials) { | 41 | var partialRight = baseRest(function(func, partials) { |
| 42 | var holders = replaceHolders(partials, getHolder(partialRight)); | 42 | var holders = replaceHolders(partials, getHolder(partialRight)); |
| 43 | return createWrap(func, PARTIAL_RIGHT_FLAG, undefined, partials, holders); | 43 | return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders); |
| 44 | }); | 44 | }); |
| 45 | 45 | ||
| 46 | // Assign default placeholders. | 46 | // Assign default placeholders. |
@@ -11,7 +11,7 @@ | |||
| 11 | * @memberOf _ | 11 | * @memberOf _ |
| 12 | * @category Object | 12 | * @category Object |
| 13 | * @param {Object} object The source object. | 13 | * @param {Object} object The source object. |
| 14 | * @param {...(string|string[])} [props] The property identifiers to pick. | 14 | * @param {...(string|string[])} [paths] The property paths to pick. |
| 15 | * @returns {Object} Returns the new object. | 15 | * @returns {Object} Returns the new object. |
| 16 | * @example | 16 | * @example |
| 17 | * | 17 | * |
@@ -20,8 +20,8 @@ | |||
| 20 | * _.pick(object, ['a', 'c']); | 20 | * _.pick(object, ['a', 'c']); |
| 21 | * // => { 'a': 1, 'c': 3 } | 21 | * // => { 'a': 1, 'c': 3 } |
| 22 | */ | 22 | */ |
| 23 | var pick = flatRest(function(object, props) { | ||
| 24 | return object == null ? {} : basePick(object, arrayMap(props, toKey)); | 23 | var pick = flatRest(function(object, paths) { |
| 24 | return object == null ? {} : basePick(object, arrayMap(paths, toKey)); | ||
| 25 | }); | 25 | }); |
| 26 | 26 | ||
| 27 | module.exports = pick; | 27 | module.exports = pick; |
@@ -2,7 +2,7 @@ | |||
| 2 | flatRest = require('./_flatRest'); | 2 | flatRest = require('./_flatRest'); |
| 3 | 3 | ||
| 4 | /** Used to compose bitmasks for function metadata. */ | 4 | /** Used to compose bitmasks for function metadata. */ |
| 5 | var REARG_FLAG = 256; | 5 | var WRAP_REARG_FLAG = 256; |
| 6 | 6 | ||
| 7 | /** | 7 | /** |
| 8 | * Creates a function that invokes `func` with arguments arranged according | 8 | * Creates a function that invokes `func` with arguments arranged according |
@@ -27,7 +27,7 @@ | |||
| 27 | * // => ['a', 'b', 'c'] | 27 | * // => ['a', 'b', 'c'] |
| 28 | */ | 28 | */ |
| 29 | var rearg = flatRest(function(func, indexes) { | 29 | var rearg = flatRest(function(func, indexes) { |
| 30 | return createWrap(func, REARG_FLAG, undefined, undefined, undefined, indexes); | 30 | return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes); |
| 31 | }); | 31 | }); |
| 32 | 32 | ||
| 33 | module.exports = rearg; | 33 | module.exports = rearg; |
@@ -1,25 +1,26 @@ | |||
| 1 | var baseAssignValue = require('./_baseAssignValue'); | 1 | var baseGet = require('./_baseGet'), |
| 2 | baseSet = require('./_baseSet'); | ||
| 2 | 3 | ||
| 3 | /** | 4 | /** |
| 4 | * The base implementation of `_.pickBy` without support for iteratee shorthands. | 5 | * The base implementation of `_.pickBy` without support for iteratee shorthands. |
| 5 | * | 6 | * |
| 6 | * @private | 7 | * @private |
| 7 | * @param {Object} object The source object. | 8 | * @param {Object} object The source object. |
| 8 | * @param {string[]} props The property identifiers to pick from. | 9 | * @param {string[]} paths The property paths to pick. |
| 9 | * @param {Function} predicate The function invoked per property. | 10 | * @param {Function} predicate The function invoked per property. |
| 10 | * @returns {Object} Returns the new object. | 11 | * @returns {Object} Returns the new object. |
| 11 | */ | 12 | */ |
| 12 | function basePickBy(object, props, predicate) { | 13 | function basePickBy(object, paths, predicate) { |
| 13 | var index = -1, | 14 | var index = -1, |
| 14 | length = props.length, | 15 | length = paths.length, |
| 15 | result = {}; | 16 | result = {}; |
| 16 | 17 | ||
| 17 | while (++index < length) { | 18 | while (++index < length) { |
| 18 | var key = props[index], | ||
| 19 | value = object[key]; | 19 | var path = paths[index], |
| 20 | value = baseGet(object, path); | ||
| 20 | 21 | ||
| 21 | if (predicate(value, key)) { | ||
| 22 | baseAssignValue(result, key, value); | 22 | if (predicate(value, path)) { |
| 23 | baseSet(result, path, value); | ||
| 23 | } | 24 | } |
| 24 | } | 25 | } |
| 25 | return result; | 26 | return result; |
@@ -1,4 +1,5 @@ | |||
| 1 | var basePickBy = require('./_basePickBy'); | 1 | var basePickBy = require('./_basePickBy'), |
| 2 | hasIn = require('./hasIn'); | ||
| 2 | 3 | ||
| 3 | /** | 4 | /** |
| 4 | * The base implementation of `_.pick` without support for individual | 5 | * The base implementation of `_.pick` without support for individual |
@@ -6,13 +7,13 @@ | |||
| 6 | * | 7 | * |
| 7 | * @private | 8 | * @private |
| 8 | * @param {Object} object The source object. | 9 | * @param {Object} object The source object. |
| 9 | * @param {string[]} props The property identifiers to pick. | 10 | * @param {string[]} paths The property paths to pick. |
| 10 | * @returns {Object} Returns the new object. | 11 | * @returns {Object} Returns the new object. |
| 11 | */ | 12 | */ |
| 12 | function basePick(object, props) { | 13 | function basePick(object, paths) { |
| 13 | object = Object(object); | 14 | object = Object(object); |
| 14 | return basePickBy(object, props, function(value, key) { | ||
| 15 | return key in object; | 15 | return basePickBy(object, paths, function(value, path) { |
| 16 | return hasIn(object, path); | ||
| 16 | }); | 17 | }); |
| 17 | } | 18 | } |
| 18 | 19 | ||
@@ -6,9 +6,9 @@ | |||
| 6 | matchesStrictComparable = require('./_matchesStrictComparable'), | 6 | matchesStrictComparable = require('./_matchesStrictComparable'), |
| 7 | toKey = require('./_toKey'); | 7 | toKey = require('./_toKey'); |
| 8 | 8 | ||
| 9 | /** Used to compose bitmasks for comparison styles. */ | ||
| 10 | var UNORDERED_COMPARE_FLAG = 1, | ||
| 11 | PARTIAL_COMPARE_FLAG = 2; | 9 | /** Used to compose bitmasks for value comparisons. */ |
| 10 | var COMPARE_PARTIAL_FLAG = 1, | ||
| 11 | COMPARE_UNORDERED_FLAG = 2; | ||
| 12 | 12 | ||
| 13 | /** | 13 | /** |
| 14 | * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. | 14 | * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. |
@@ -26,7 +26,7 @@ | |||
| 26 | var objValue = get(object, path); | 26 | var objValue = get(object, path); |
| 27 | return (objValue === undefined && objValue === srcValue) | 27 | return (objValue === undefined && objValue === srcValue) |
| 28 | ? hasIn(object, path) | 28 | ? hasIn(object, path) |
| 29 | : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); | 29 | : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); |
| 30 | }; | 30 | }; |
| 31 | } | 31 | } |
| 32 | 32 | ||
@@ -1,9 +1,9 @@ | |||
| 1 | var Stack = require('./_Stack'), | 1 | var Stack = require('./_Stack'), |
| 2 | baseIsEqual = require('./_baseIsEqual'); | 2 | baseIsEqual = require('./_baseIsEqual'); |
| 3 | 3 | ||
| 4 | /** Used to compose bitmasks for comparison styles. */ | ||
| 5 | var UNORDERED_COMPARE_FLAG = 1, | ||
| 6 | PARTIAL_COMPARE_FLAG = 2; | 4 | /** Used to compose bitmasks for value comparisons. */ |
| 5 | var COMPARE_PARTIAL_FLAG = 1, | ||
| 6 | COMPARE_UNORDERED_FLAG = 2; | ||
| 7 | 7 | ||
| 8 | /** | 8 | /** |
| 9 | * The base implementation of `_.isMatch` without support for iteratee shorthands. | 9 | * The base implementation of `_.isMatch` without support for iteratee shorthands. |
@@ -49,7 +49,7 @@ | |||
| 49 | var result = customizer(objValue, srcValue, key, object, source, stack); | 49 | var result = customizer(objValue, srcValue, key, object, source, stack); |
| 50 | } | 50 | } |
| 51 | if (!(result === undefined | 51 | if (!(result === undefined |
| 52 | ? baseIsEqual(srcValue, objValue, customizer, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG, stack) | 52 | ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) |
| 53 | : result | 53 | : result |
| 54 | )) { | 54 | )) { |
| 55 | return false; | 55 | return false; |
@@ -7,8 +7,8 @@ | |||
| 7 | isBuffer = require('./isBuffer'), | 7 | isBuffer = require('./isBuffer'), |
| 8 | isTypedArray = require('./isTypedArray'); | 8 | isTypedArray = require('./isTypedArray'); |
| 9 | 9 | ||
| 10 | /** Used to compose bitmasks for comparison styles. */ | ||
| 11 | var PARTIAL_COMPARE_FLAG = 2; | 10 | /** Used to compose bitmasks for value comparisons. */ |
| 11 | var COMPARE_PARTIAL_FLAG = 1; | ||
| 12 | 12 | ||
| 13 | /** `Object#toString` result references. */ | 13 | /** `Object#toString` result references. */ |
| 14 | var argsTag = '[object Arguments]', | 14 | var argsTag = '[object Arguments]', |
@@ -29,14 +29,13 @@ | |||
| 29 | * @private | 29 | * @private |
| 30 | * @param {Object} object The object to compare. | 30 | * @param {Object} object The object to compare. |
| 31 | * @param {Object} other The other object to compare. | 31 | * @param {Object} other The other object to compare. |
| 32 | * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. | ||
| 33 | * @param {Function} customizer The function to customize comparisons. | ||
| 32 | * @param {Function} equalFunc The function to determine equivalents of values. | 34 | * @param {Function} equalFunc The function to determine equivalents of values. |
| 33 | * @param {Function} [customizer] The function to customize comparisons. | ||
| 34 | * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual` | ||
| 35 | * for more details. | ||
| 36 | * @param {Object} [stack] Tracks traversed `object` and `other` objects. | 35 | * @param {Object} [stack] Tracks traversed `object` and `other` objects. |
| 37 | * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. | 36 | * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. |
| 38 | */ | 37 | */ |
| 39 | function baseIsEqualDeep(object, other, equalFunc, customizer, bitmask, stack) { | 38 | function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { |
| 40 | var objIsArr = isArray(object), | 39 | var objIsArr = isArray(object), |
| 41 | othIsArr = isArray(other), | 40 | othIsArr = isArray(other), |
| 42 | objTag = arrayTag, | 41 | objTag = arrayTag, |
@@ -64,10 +63,10 @@ | |||
| 64 | if (isSameTag && !objIsObj) { | 63 | if (isSameTag && !objIsObj) { |
| 65 | stack || (stack = new Stack); | 64 | stack || (stack = new Stack); |
| 66 | return (objIsArr || isTypedArray(object)) | 65 | return (objIsArr || isTypedArray(object)) |
| 67 | ? equalArrays(object, other, equalFunc, customizer, bitmask, stack) | ||
| 68 | : equalByTag(object, other, objTag, equalFunc, customizer, bitmask, stack); | 66 | ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) |
| 67 | : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); | ||
| 69 | } | 68 | } |
| 70 | if (!(bitmask & PARTIAL_COMPARE_FLAG)) { | 69 | if (!(bitmask & COMPARE_PARTIAL_FLAG)) { |
| 71 | var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), | 70 | var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), |
| 72 | othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); | 71 | othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); |
| 73 | 72 | ||
@@ -76,14 +75,14 @@ | |||
| 76 | othUnwrapped = othIsWrapped ? other.value() : other; | 75 | othUnwrapped = othIsWrapped ? other.value() : other; |
| 77 | 76 | ||
| 78 | stack || (stack = new Stack); | 77 | stack || (stack = new Stack); |
| 79 | return equalFunc(objUnwrapped, othUnwrapped, customizer, bitmask, stack); | 78 | return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); |
| 80 | } | 79 | } |
| 81 | } | 80 | } |
| 82 | if (!isSameTag) { | 81 | if (!isSameTag) { |
| 83 | return false; | 82 | return false; |
| 84 | } | 83 | } |
| 85 | stack || (stack = new Stack); | 84 | stack || (stack = new Stack); |
| 86 | return equalObjects(object, other, equalFunc, customizer, bitmask, stack); | 85 | return equalObjects(object, other, bitmask, customizer, equalFunc, stack); |
| 87 | } | 86 | } |
| 88 | 87 | ||
| 89 | module.exports = baseIsEqualDeep; | 88 | module.exports = baseIsEqualDeep; |
@@ -9,22 +9,21 @@ | |||
| 9 | * @private | 9 | * @private |
| 10 | * @param {*} value The value to compare. | 10 | * @param {*} value The value to compare. |
| 11 | * @param {*} other The other value to compare. | 11 | * @param {*} other The other value to compare. |
| 12 | * @param {boolean} bitmask The bitmask flags. | ||
| 13 | * 1 - Unordered comparison | ||
| 14 | * 2 - Partial comparison | ||
| 12 | * @param {Function} [customizer] The function to customize comparisons. | 15 | * @param {Function} [customizer] The function to customize comparisons. |
| 13 | * @param {boolean} [bitmask] The bitmask of comparison flags. | ||
| 14 | * The bitmask may be composed of the following flags: | ||
| 15 | * 1 - Unordered comparison | ||
| 16 | * 2 - Partial comparison | ||
| 17 | * @param {Object} [stack] Tracks traversed `value` and `other` objects. | 16 | * @param {Object} [stack] Tracks traversed `value` and `other` objects. |
| 18 | * @returns {boolean} Returns `true` if the values are equivalent, else `false`. | 17 | * @returns {boolean} Returns `true` if the values are equivalent, else `false`. |
| 19 | */ | 18 | */ |
| 20 | function baseIsEqual(value, other, customizer, bitmask, stack) { | 19 | function baseIsEqual(value, other, bitmask, customizer, stack) { |
| 21 | if (value === other) { | 20 | if (value === other) { |
| 22 | return true; | 21 | return true; |
| 23 | } | 22 | } |
| 24 | if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) { | 23 | if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) { |
| 25 | return value !== value && other !== other; | 24 | return value !== value && other !== other; |
| 26 | } | 25 | } |
| 27 | return baseIsEqualDeep(value, other, baseIsEqual, customizer, bitmask, stack); | 26 | return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack); |
| 28 | } | 27 | } |
| 29 | 28 | ||
| 30 | module.exports = baseIsEqual; | 29 | module.exports = baseIsEqual; |
@@ -51,11 +51,15 @@ | |||
| 51 | start = start === undefined ? 0 : nativeMax(toInteger(start), 0); | 51 | start = start === undefined ? 0 : nativeMax(toInteger(start), 0); |
| 52 | return baseRest(function(args) { | 52 | return baseRest(function(args) { |
| 53 | var array = args[start], | 53 | var array = args[start], |
| 54 | lastIndex = args.length - 1, | ||
| 54 | otherArgs = castSlice(args, 0, start); | 55 | otherArgs = castSlice(args, 0, start); |
| 55 | 56 | ||
| 56 | if (array) { | 57 | if (array) { |
| 57 | arrayPush(otherArgs, array); | 58 | arrayPush(otherArgs, array); |
| 58 | } | 59 | } |
| 60 | if (start != lastIndex) { | ||
| 61 | arrayPush(otherArgs, castSlice(args, start + 1)); | ||
| 62 | } | ||
| 59 | return apply(func, this, otherArgs); | 63 | return apply(func, this, otherArgs); |
| 60 | }); | 64 | }); |
| 61 | } | 65 | } |
@@ -2,10 +2,13 @@ | |||
| 2 | arrayEach = require('./_arrayEach'), | 2 | arrayEach = require('./_arrayEach'), |
| 3 | assignValue = require('./_assignValue'), | 3 | assignValue = require('./_assignValue'), |
| 4 | baseAssign = require('./_baseAssign'), | 4 | baseAssign = require('./_baseAssign'), |
| 5 | baseAssignIn = require('./_baseAssignIn'), | ||
| 5 | cloneBuffer = require('./_cloneBuffer'), | 6 | cloneBuffer = require('./_cloneBuffer'), |
| 6 | copyArray = require('./_copyArray'), | 7 | copyArray = require('./_copyArray'), |
| 7 | copySymbols = require('./_copySymbols'), | 8 | copySymbols = require('./_copySymbols'), |
| 9 | copySymbolsIn = require('./_copySymbolsIn'), | ||
| 8 | getAllKeys = require('./_getAllKeys'), | 10 | getAllKeys = require('./_getAllKeys'), |
| 11 | getAllKeysIn = require('./_getAllKeysIn'), | ||
| 9 | getTag = require('./_getTag'), | 12 | getTag = require('./_getTag'), |
| 10 | initCloneArray = require('./_initCloneArray'), | 13 | initCloneArray = require('./_initCloneArray'), |
| 11 | initCloneByTag = require('./_initCloneByTag'), | 14 | initCloneByTag = require('./_initCloneByTag'), |
@@ -15,6 +18,11 @@ | |||
| 15 | isObject = require('./isObject'), | 18 | isObject = require('./isObject'), |
| 16 | keys = require('./keys'); | 19 | keys = require('./keys'); |
| 17 | 20 | ||
| 21 | /** Used to compose bitmasks for cloning. */ | ||
| 22 | var CLONE_DEEP_FLAG = 1, | ||
| 23 | CLONE_FLAT_FLAG = 2, | ||
| 24 | CLONE_SYMBOLS_FLAG = 4; | ||
| 25 | |||
| 18 | /** `Object#toString` result references. */ | 26 | /** `Object#toString` result references. */ |
| 19 | var argsTag = '[object Arguments]', | 27 | var argsTag = '[object Arguments]', |
| 20 | arrayTag = '[object Array]', | 28 | arrayTag = '[object Array]', |
@@ -66,16 +74,22 @@ | |||
| 66 | * | 74 | * |
| 67 | * @private | 75 | * @private |
| 68 | * @param {*} value The value to clone. | 76 | * @param {*} value The value to clone. |
| 69 | * @param {boolean} [isDeep] Specify a deep clone. | ||
| 70 | * @param {boolean} [isFull] Specify a clone including symbols. | 77 | * @param {boolean} bitmask The bitmask flags. |
| 78 | * 1 - Deep clone | ||
| 79 | * 2 - Flatten inherited properties | ||
| 80 | * 4 - Clone symbols | ||
| 71 | * @param {Function} [customizer] The function to customize cloning. | 81 | * @param {Function} [customizer] The function to customize cloning. |
| 72 | * @param {string} [key] The key of `value`. | 82 | * @param {string} [key] The key of `value`. |
| 73 | * @param {Object} [object] The parent object of `value`. | 83 | * @param {Object} [object] The parent object of `value`. |
| 74 | * @param {Object} [stack] Tracks traversed objects and their clone counterparts. | 84 | * @param {Object} [stack] Tracks traversed objects and their clone counterparts. |
| 75 | * @returns {*} Returns the cloned value. | 85 | * @returns {*} Returns the cloned value. |
| 76 | */ | 86 | */ |
| 77 | function baseClone(value, isDeep, isFull, customizer, key, object, stack) { | ||
| 78 | var result; | 87 | function baseClone(value, bitmask, customizer, key, object, stack) { |
| 88 | var result, | ||
| 89 | isDeep = bitmask & CLONE_DEEP_FLAG, | ||
| 90 | isFlat = bitmask & CLONE_FLAT_FLAG, | ||
| 91 | isFull = bitmask & CLONE_SYMBOLS_FLAG; | ||
| 92 | |||
| 79 | if (customizer) { | 93 | if (customizer) { |
| 80 | result = object ? customizer(value, key, object, stack) : customizer(value); | 94 | result = object ? customizer(value, key, object, stack) : customizer(value); |
| 81 | } | 95 | } |
@@ -99,9 +113,11 @@ | |||
| 99 | return cloneBuffer(value, isDeep); | 113 | return cloneBuffer(value, isDeep); |
| 100 | } | 114 | } |
| 101 | if (tag == objectTag || tag == argsTag || (isFunc && !object)) { | 115 | if (tag == objectTag || tag == argsTag || (isFunc && !object)) { |
| 102 | result = initCloneObject(isFunc ? {} : value); | 116 | result = (isFlat || isFunc) ? {} : initCloneObject(value); |
| 103 | if (!isDeep) { | 117 | if (!isDeep) { |
| 104 | return copySymbols(value, baseAssign(result, value)); | 118 | return isFlat |
| 119 | ? copySymbolsIn(value, baseAssignIn(result, value)) | ||
| 120 | : copySymbols(value, baseAssign(result, value)); | ||
| 105 | } | 121 | } |
| 106 | } else { | 122 | } else { |
| 107 | if (!cloneableTags[tag]) { | 123 | if (!cloneableTags[tag]) { |
@@ -118,14 +134,18 @@ | |||
| 118 | } | 134 | } |
| 119 | stack.set(value, result); | 135 | stack.set(value, result); |
| 120 | 136 | ||
| 121 | var props = isArr ? undefined : (isFull ? getAllKeys : keys)(value); | 137 | var keysFunc = isFull |
| 138 | ? (isFlat ? getAllKeysIn : getAllKeys) | ||
| 139 | : (isFlat ? keysIn : keys); | ||
| 140 | |||
| 141 | var props = isArr ? undefined : keysFunc(value); | ||
| 122 | arrayEach(props || value, function(subValue, key) { | 142 | arrayEach(props || value, function(subValue, key) { |
| 123 | if (props) { | 143 | if (props) { |
| 124 | key = subValue; | 144 | key = subValue; |
| 125 | subValue = value[key]; | 145 | subValue = value[key]; |
| 126 | } | 146 | } |
| 127 | // Recursively populate clone (susceptible to call stack limits). | 147 | // Recursively populate clone (susceptible to call stack limits). |
| 128 | assignValue(result, key, baseClone(subValue, isDeep, isFull, customizer, key, value, stack)); | 148 | assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack)); |
| 129 | }); | 149 | }); |
| 130 | return result; | 150 | return result; |
| 131 | } | 151 | } |
@@ -5,7 +5,7 @@ | |||
| 5 | * | 5 | * |
| 6 | * @private | 6 | * @private |
| 7 | * @param {Object} object The object to iterate over. | 7 | * @param {Object} object The object to iterate over. |
| 8 | * @param {string[]} paths The property paths of elements to pick. | 8 | * @param {string[]} paths The property paths to pick. |
| 9 | * @returns {Array} Returns the picked elements. | 9 | * @returns {Array} Returns the picked elements. |
| 10 | */ | 10 | */ |
| 11 | function baseAt(object, paths) { | 11 | function baseAt(object, paths) { |
@@ -12,7 +12,7 @@ | |||
| 12 | * @memberOf _ | 12 | * @memberOf _ |
| 13 | * @since 1.0.0 | 13 | * @since 1.0.0 |
| 14 | * @category Seq | 14 | * @category Seq |
| 15 | * @param {...(string|string[])} [paths] The property paths of elements to pick. | 15 | * @param {...(string|string[])} [paths] The property paths to pick. |
| 16 | * @returns {Object} Returns the new `lodash` wrapper instance. | 16 | * @returns {Object} Returns the new `lodash` wrapper instance. |
| 17 | * @example | 17 | * @example |
| 18 | * | 18 | * |
@@ -172,9 +172,9 @@ | |||
| 172 | 172 | ||
| 173 | /** Used to map method names to rearg configs. */ | 173 | /** Used to map method names to rearg configs. */ |
| 174 | exports.methodRearg = { | 174 | exports.methodRearg = { |
| 175 | 'assignInAllWith': [1, 2, 0], | 175 | 'assignInAllWith': [1, 0], |
| 176 | 'assignInWith': [1, 2, 0], | 176 | 'assignInWith': [1, 2, 0], |
| 177 | 'assignAllWith': [1, 2, 0], | 177 | 'assignAllWith': [1, 0], |
| 178 | 'assignWith': [1, 2, 0], | 178 | 'assignWith': [1, 2, 0], |
| 179 | 'differenceBy': [1, 2, 0], | 179 | 'differenceBy': [1, 2, 0], |
| 180 | 'differenceWith': [1, 2, 0], | 180 | 'differenceWith': [1, 2, 0], |
@@ -183,7 +183,7 @@ | |||
| 183 | 'intersectionWith': [1, 2, 0], | 183 | 'intersectionWith': [1, 2, 0], |
| 184 | 'isEqualWith': [1, 2, 0], | 184 | 'isEqualWith': [1, 2, 0], |
| 185 | 'isMatchWith': [2, 1, 0], | 185 | 'isMatchWith': [2, 1, 0], |
| 186 | 'mergeAllWith': [1, 2, 0], | 186 | 'mergeAllWith': [1, 0], |
| 187 | 'mergeWith': [1, 2, 0], | 187 | 'mergeWith': [1, 2, 0], |
| 188 | 'padChars': [2, 1, 0], | 188 | 'padChars': [2, 1, 0], |
| 189 | 'padCharsEnd': [2, 1, 0], | 189 | 'padCharsEnd': [2, 1, 0], |
@@ -206,15 +206,15 @@ | |||
| 206 | /** Used to map method names to spread configs. */ | 206 | /** Used to map method names to spread configs. */ |
| 207 | exports.methodSpread = { | 207 | exports.methodSpread = { |
| 208 | 'assignAll': { 'start': 0 }, | 208 | 'assignAll': { 'start': 0 }, |
| 209 | 'assignAllWith': { 'afterRearg': true, 'start': 1 }, | 209 | 'assignAllWith': { 'start': 0 }, |
| 210 | 'assignInAll': { 'start': 0 }, | 210 | 'assignInAll': { 'start': 0 }, |
| 211 | 'assignInAllWith': { 'afterRearg': true, 'start': 1 }, | 211 | 'assignInAllWith': { 'start': 0 }, |
| 212 | 'defaultsAll': { 'start': 0 }, | 212 | 'defaultsAll': { 'start': 0 }, |
| 213 | 'defaultsDeepAll': { 'start': 0 }, | 213 | 'defaultsDeepAll': { 'start': 0 }, |
| 214 | 'invokeArgs': { 'start': 2 }, | 214 | 'invokeArgs': { 'start': 2 }, |
| 215 | 'invokeArgsMap': { 'start': 2 }, | 215 | 'invokeArgsMap': { 'start': 2 }, |
| 216 | 'mergeAll': { 'start': 0 }, | 216 | 'mergeAll': { 'start': 0 }, |
| 217 | 'mergeAllWith': { 'afterRearg': true, 'start': 1 }, | 217 | 'mergeAllWith': { 'start': 0 }, |
| 218 | 'partial': { 'start': 1 }, | 218 | 'partial': { 'start': 1 }, |
| 219 | 'partialRight': { 'start': 1 }, | 219 | 'partialRight': { 'start': 1 }, |
| 220 | 'without': { 'start': 1 }, | 220 | 'without': { 'start': 1 }, |
@@ -0,0 +1,16 @@ | |
| 1 | var copyObject = require('./_copyObject'), |
| 2 | getSymbolsIn = require('./_getSymbolsIn'); |
| 3 | |
| 4 | /** |
| 5 | * Copies own and inherited symbols of `source` to `object`. |
| 6 | * |
| 7 | * @private |
| 8 | * @param {Object} source The object to copy symbols from. |
| 9 | * @param {Object} [object={}] The object to copy symbols to. |
| 10 | * @returns {Object} Returns `object`. |
| 11 | */ |
| 12 | function copySymbolsIn(source, object) { |
| 13 | return copyObject(source, getSymbolsIn(source), object); |
| 14 | } |
| 15 | |
| 16 | module.exports = copySymbolsIn; |
@@ -0,0 +1,17 @@ | |
| 1 | var copyObject = require('./_copyObject'), |
| 2 | keysIn = require('./keysIn'); |
| 3 | |
| 4 | /** |
| 5 | * The base implementation of `_.assignIn` without support for multiple sources |
| 6 | * or `customizer` functions. |
| 7 | * |
| 8 | * @private |
| 9 | * @param {Object} object The destination object. |
| 10 | * @param {Object} source The source object. |
| 11 | * @returns {Object} Returns `object`. |
| 12 | */ |
| 13 | function baseAssignIn(object, source) { |
| 14 | return object && copyObject(source, keysIn(source), object); |
| 15 | } |
| 16 | |
| 17 | module.exports = baseAssignIn; |
Publish
Install