...**/!(*.map|*.min.js)Size
Gzip
Dependencies
Publish
Install
Publish
Install
@@ -1,6 +1,6 @@ | |||
| 1 | { | 1 | { |
| 2 | "name": "lodash", | 2 | "name": "lodash", |
| 3 | "version": "4.15.0", | 3 | "version": "4.16.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/", |
@@ -1,12 +1,12 @@ | |||
| 1 | # lodash v4.15.0 | 1 | # lodash v4.16.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 | ||
| 5 | ## Installation | 5 | ## Installation |
| 6 | 6 | ||
| 7 | Using npm: | 7 | Using npm: |
| 8 | ```bash | ||
| 9 | $ {sudo -H} npm i -g npm | 8 | ```shell |
| 9 | $ npm i -g npm | ||
| 10 | $ npm i --save lodash | 10 | $ npm i --save lodash |
| 11 | ``` | 11 | ``` |
| 12 | 12 | ||
@@ -16,25 +16,24 @@ | |||
| 16 | var _ = require('lodash'); | 16 | var _ = require('lodash'); |
| 17 | // Load the core build. | 17 | // Load the core build. |
| 18 | var _ = require('lodash/core'); | 18 | var _ = require('lodash/core'); |
| 19 | // Load the fp build for immutable auto-curried iteratee-first data-last methods. | 19 | // Load the FP build for immutable auto-curried iteratee-first data-last methods. |
| 20 | var fp = require('lodash/fp'); | 20 | var fp = require('lodash/fp'); |
| 21 | 21 | ||
| 22 | // Load a method category. | 22 | // Load method categories. |
| 23 | var array = require('lodash/array'); | 23 | var array = require('lodash/array'); |
| 24 | var object = require('lodash/fp/object'); | 24 | var object = require('lodash/fp/object'); |
| 25 | 25 | ||
| 26 | // Load a single method for smaller builds with browserify/rollup/webpack. | 26 | // Cherry-pick methods for smaller browserify/rollup/webpack bundles. |
| 27 | var chunk = require('lodash/chunk'); | 27 | var chunk = require('lodash/chunk'); |
| 28 | var extend = require('lodash/fp/extend'); | 28 | var extend = require('lodash/fp/extend'); |
| 29 | ``` | 29 | ``` |
| 30 | 30 | ||
| 31 | See the [package source](https://github.com/lodash/lodash/tree/4.15.0-npm) for more details. | 31 | See the [package source](https://github.com/lodash/lodash/tree/4.16.0-npm) for more details. |
| 32 | 32 | ||
| 33 | **Note:**<br> | 33 | **Note:**<br> |
| 34 | Don’t assign values to the [special variable](http://nodejs.org/api/repl.html#repl_repl_features) `_` in the Node.js < 6 REPL.<br> | ||
| 35 | Install [n_](https://www.npmjs.com/package/n_) for a REPL that includes `lodash` by default. | 34 | Install [n_](https://www.npmjs.com/package/n_) for Lodash use in the Node.js < 6 REPL. |
| 36 | 35 | ||
| 37 | ## Support | 36 | ## Support |
| 38 | 37 | ||
| 39 | Tested in Chrome 51-52, Firefox 47-48, IE 9-11, Edge 14, Safari 8-9, Node.js 0.10-6, & PhantomJS 2.1.1.<br> | 38 | Tested in Chrome 52-53, Firefox 47-48, IE 11, Edge 14, Safari 8-9, Node.js 4-6, & PhantomJS 2.1.1.<br> |
| 40 | Automated [browser](https://saucelabs.com/u/lodash) & [CI](https://travis-ci.org/lodash/lodash/) test runs are available. | 39 | Automated [browser](https://saucelabs.com/u/lodash) & [CI](https://travis-ci.org/lodash/lodash/) test runs are available. |
@@ -1,4 +1,5 @@ | |||
| 1 | var createAggregator = require('./_createAggregator'); | 1 | var baseAssignValue = require('./_baseAssignValue'), |
| 2 | createAggregator = require('./_createAggregator'); | ||
| 2 | 3 | ||
| 3 | /** Used for built-in method references. */ | 4 | /** Used for built-in method references. */ |
| 4 | var objectProto = Object.prototype; | 5 | var objectProto = Object.prototype; |
@@ -30,7 +31,11 @@ | |||
| 30 | * // => { '3': 2, '5': 1 } | 31 | * // => { '3': 2, '5': 1 } |
| 31 | */ | 32 | */ |
| 32 | var countBy = createAggregator(function(result, value, key) { | 33 | var countBy = createAggregator(function(result, value, key) { |
| 33 | hasOwnProperty.call(result, key) ? ++result[key] : (result[key] = 1); | 34 | if (hasOwnProperty.call(result, key)) { |
| 35 | ++result[key]; | ||
| 36 | } else { | ||
| 37 | baseAssignValue(result, key, 1); | ||
| 38 | } | ||
| 34 | }); | 39 | }); |
| 35 | 40 | ||
| 36 | module.exports = countBy; | 41 | module.exports = countBy; |
@@ -1,7 +1,7 @@ | |||
| 1 | var arrayEach = require('./_arrayEach'), | 1 | var arrayEach = require('./_arrayEach'), |
| 2 | baseFlatten = require('./_baseFlatten'), | ||
| 3 | baseRest = require('./_baseRest'), | 2 | baseAssignValue = require('./_baseAssignValue'), |
| 4 | bind = require('./bind'), | 3 | bind = require('./bind'), |
| 4 | flatRest = require('./_flatRest'), | ||
| 5 | toKey = require('./_toKey'); | 5 | toKey = require('./_toKey'); |
| 6 | 6 | ||
| 7 | /** | 7 | /** |
@@ -30,10 +30,10 @@ | |||
| 30 | * jQuery(element).on('click', view.click); | 30 | * jQuery(element).on('click', view.click); |
| 31 | * // => Logs 'clicked docs' when clicked. | 31 | * // => Logs 'clicked docs' when clicked. |
| 32 | */ | 32 | */ |
| 33 | var bindAll = baseRest(function(object, methodNames) { | ||
| 34 | arrayEach(baseFlatten(methodNames, 1), function(key) { | 33 | var bindAll = flatRest(function(object, methodNames) { |
| 34 | arrayEach(methodNames, function(key) { | ||
| 35 | key = toKey(key); | 35 | key = toKey(key); |
| 36 | object[key] = bind(object[key], object); | 36 | baseAssignValue(object, key, bind(object[key], object)); |
| 37 | }); | 37 | }); |
| 38 | return object; | 38 | return object; |
| 39 | }); | 39 | }); |
@@ -17,7 +17,7 @@ | |||
| 17 | * _.defer(function(text) { | 17 | * _.defer(function(text) { |
| 18 | * console.log(text); | 18 | * console.log(text); |
| 19 | * }, 'deferred'); | 19 | * }, 'deferred'); |
| 20 | * // => Logs 'deferred' after one or more milliseconds. | 20 | * // => Logs 'deferred' after one millisecond. |
| 21 | */ | 21 | */ |
| 22 | var defer = baseRest(function(func, args) { | 22 | var defer = baseRest(function(func, args) { |
| 23 | return baseDelay(func, 1, args); | 23 | return baseDelay(func, 1, args); |
@@ -6,8 +6,8 @@ | |||
| 6 | /** | 6 | /** |
| 7 | * Creates an array of `array` values not included in the other given arrays | 7 | * Creates an array of `array` values not included in the other given arrays |
| 8 | * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) | 8 | * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) |
| 9 | * for equality comparisons. The order of result values is determined by the | ||
| 10 | * order they occur in the first array. | 9 | * for equality comparisons. The order and references of result values are |
| 10 | * determined by the first array. | ||
| 11 | * | 11 | * |
| 12 | * **Note:** Unlike `_.pullAll`, this method returns a new array. | 12 | * **Note:** Unlike `_.pullAll`, this method returns a new array. |
| 13 | * | 13 | * |
@@ -1,6 +1,5 @@ | |||
| 1 | var baseAt = require('./_baseAt'), | 1 | var baseAt = require('./_baseAt'), |
| 2 | baseFlatten = require('./_baseFlatten'), | ||
| 3 | baseRest = require('./_baseRest'); | 2 | flatRest = require('./_flatRest'); |
| 4 | 3 | ||
| 5 | /** | 4 | /** |
| 6 | * Creates an array of values corresponding to `paths` of `object`. | 5 | * Creates an array of values corresponding to `paths` of `object`. |
@@ -19,8 +18,6 @@ | |||
| 19 | * _.at(object, ['a[0].b.c', 'a[1]']); | 18 | * _.at(object, ['a[0].b.c', 'a[1]']); |
| 20 | * // => [3, 4] | 19 | * // => [3, 4] |
| 21 | */ | 20 | */ |
| 22 | var at = baseRest(function(object, paths) { | ||
| 23 | return baseAt(object, baseFlatten(paths, 1)); | ||
| 24 | }); | 21 | var at = flatRest(baseAt); |
| 25 | 22 | ||
| 26 | module.exports = at; | 23 | module.exports = at; |
@@ -8,8 +8,9 @@ | |||
| 8 | /** | 8 | /** |
| 9 | * This method is like `_.difference` except that it accepts `iteratee` which | 9 | * This method is like `_.difference` except that it accepts `iteratee` which |
| 10 | * is invoked for each element of `array` and `values` to generate the criterion | 10 | * is invoked for each element of `array` and `values` to generate the criterion |
| 11 | * by which they're compared. Result values are chosen from the first array. | ||
| 12 | * The iteratee is invoked with one argument: (value). | 11 | * by which they're compared. The order and references of result values are |
| 12 | * determined by the first array. The iteratee is invoked with one argument: | ||
| 13 | * (value). | ||
| 13 | * | 14 | * |
| 14 | * **Note:** Unlike `_.pullAllBy`, this method returns a new array. | 15 | * **Note:** Unlike `_.pullAllBy`, this method returns a new array. |
| 15 | * | 16 | * |
@@ -6,9 +6,9 @@ | |||
| 6 | 6 | ||
| 7 | /** | 7 | /** |
| 8 | * This method is like `_.difference` except that it accepts `comparator` | 8 | * This method is like `_.difference` except that it accepts `comparator` |
| 9 | * which is invoked to compare elements of `array` to `values`. Result values | ||
| 10 | * are chosen from the first array. The comparator is invoked with two arguments: | ||
| 11 | * (arrVal, othVal). | 9 | * which is invoked to compare elements of `array` to `values`. The order and |
| 10 | * references of result values are determined by the first array. The comparator | ||
| 11 | * is invoked with two arguments: (arrVal, othVal). | ||
| 12 | * | 12 | * |
| 13 | * **Note:** Unlike `_.pullAllWith`, this method returns a new array. | 13 | * **Note:** Unlike `_.pullAllWith`, this method returns a new array. |
| 14 | * | 14 | * |
@@ -11,12 +11,6 @@ | |||
| 11 | /** Used to check objects for own properties. */ | 11 | /** Used to check objects for own properties. */ |
| 12 | var hasOwnProperty = objectProto.hasOwnProperty; | 12 | var hasOwnProperty = objectProto.hasOwnProperty; |
| 13 | 13 | ||
| 14 | /** Built-in value references. */ | ||
| 15 | var propertyIsEnumerable = objectProto.propertyIsEnumerable; | ||
| 16 | |||
| 17 | /** Detect if properties shadowing those on `Object.prototype` are non-enumerable. */ | ||
| 18 | var nonEnumShadows = !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf'); | ||
| 19 | |||
| 20 | /** | 14 | /** |
| 21 | * Assigns own enumerable string keyed properties of source objects to the | 15 | * Assigns own enumerable string keyed properties of source objects to the |
| 22 | * destination object. Source objects are applied from left to right. | 16 | * destination object. Source objects are applied from left to right. |
@@ -50,7 +44,7 @@ | |||
| 50 | * // => { 'a': 1, 'c': 3 } | 44 | * // => { 'a': 1, 'c': 3 } |
| 51 | */ | 45 | */ |
| 52 | var assign = createAssigner(function(object, source) { | 46 | var assign = createAssigner(function(object, source) { |
| 53 | if (nonEnumShadows || isPrototype(source) || isArrayLike(source)) { | 47 | if (isPrototype(source) || isArrayLike(source)) { |
| 54 | copyObject(source, keys(source), object); | 48 | copyObject(source, keys(source), object); |
| 55 | return; | 49 | return; |
| 56 | } | 50 | } |
@@ -34,7 +34,7 @@ | |||
| 34 | function unicodeSize(string) { | 34 | function unicodeSize(string) { |
| 35 | var result = reUnicode.lastIndex = 0; | 35 | var result = reUnicode.lastIndex = 0; |
| 36 | while (reUnicode.test(string)) { | 36 | while (reUnicode.test(string)) { |
| 37 | result++; | 37 | ++result; |
| 38 | } | 38 | } |
| 39 | return result; | 39 | return result; |
| 40 | } | 40 | } |
@@ -6,8 +6,8 @@ | |||
| 6 | reHasUnescapedHtml = RegExp(reUnescapedHtml.source); | 6 | reHasUnescapedHtml = RegExp(reUnescapedHtml.source); |
| 7 | 7 | ||
| 8 | /** | 8 | /** |
| 9 | * Converts the characters "&", "<", ">", '"', "'", and "\`" in `string` to | ||
| 10 | * their corresponding HTML entities. | 9 | * Converts the characters "&", "<", ">", '"', and "'" in `string` to their |
| 10 | * corresponding HTML entities. | ||
| 11 | * | 11 | * |
| 12 | * **Note:** No other characters are escaped. To escape additional | 12 | * **Note:** No other characters are escaped. To escape additional |
| 13 | * characters use a third-party library like [_he_](https://mths.be/he). | 13 | * characters use a third-party library like [_he_](https://mths.be/he). |
@@ -18,12 +18,6 @@ | |||
| 18 | * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands) | 18 | * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands) |
| 19 | * (under "semi-related fun fact") for more details. | 19 | * (under "semi-related fun fact") for more details. |
| 20 | * | 20 | * |
| 21 | * Backticks are escaped because in IE < 9, they can break out of | ||
| 22 | * attribute values or HTML comments. See [#59](https://html5sec.org/#59), | ||
| 23 | * [#102](https://html5sec.org/#102), [#108](https://html5sec.org/#108), and | ||
| 24 | * [#133](https://html5sec.org/#133) of the | ||
| 25 | * [HTML5 Security Cheatsheet](https://html5sec.org/) for more details. | ||
| 26 | * | ||
| 27 | * When working with HTML you should always | 21 | * When working with HTML you should always |
| 28 | * [quote attribute values](http://wonko.com/post/html-escaping) to reduce | 22 | * [quote attribute values](http://wonko.com/post/html-escaping) to reduce |
| 29 | * XSS vectors. | 23 | * XSS vectors. |
@@ -1,4 +1,4 @@ | |||
| 1 | var memoize = require('./memoize'), | 1 | var memoizeCapped = require('./_memoizeCapped'), |
| 2 | toString = require('./toString'); | 2 | toString = require('./toString'); |
| 3 | 3 | ||
| 4 | /** Used to match property names within property paths. */ | 4 | /** Used to match property names within property paths. */ |
@@ -15,7 +15,7 @@ | |||
| 15 | * @param {string} string The string to convert. | 15 | * @param {string} string The string to convert. |
| 16 | * @returns {Array} Returns the property path array. | 16 | * @returns {Array} Returns the property path array. |
| 17 | */ | 17 | */ |
| 18 | var stringToPath = memoize(function(string) { | 18 | var stringToPath = memoizeCapped(function(string) { |
| 19 | string = toString(string); | 19 | string = toString(string); |
| 20 | 20 | ||
| 21 | var result = []; | 21 | var result = []; |
@@ -16,16 +16,18 @@ | |||
| 16 | * @returns {Object} Returns the stack cache instance. | 16 | * @returns {Object} Returns the stack cache instance. |
| 17 | */ | 17 | */ |
| 18 | function stackSet(key, value) { | 18 | function stackSet(key, value) { |
| 19 | var cache = this.__data__; | ||
| 20 | if (cache instanceof ListCache) { | ||
| 21 | var pairs = cache.__data__; | 19 | var data = this.__data__; |
| 20 | if (data instanceof ListCache) { | ||
| 21 | var pairs = data.__data__; | ||
| 22 | if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) { | 22 | if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) { |
| 23 | pairs.push([key, value]); | 23 | pairs.push([key, value]); |
| 24 | this.size = ++data.size; | ||
| 24 | return this; | 25 | return this; |
| 25 | } | 26 | } |
| 26 | cache = this.__data__ = new MapCache(pairs); | 27 | data = this.__data__ = new MapCache(pairs); |
| 27 | } | 28 | } |
| 28 | cache.set(key, value); | 29 | data.set(key, value); |
| 30 | this.size = data.size; | ||
| 29 | return this; | 31 | return this; |
| 30 | } | 32 | } |
| 31 | 33 | ||
@@ -8,7 +8,11 @@ | |||
| 8 | * @returns {boolean} Returns `true` if the entry was removed, else `false`. | 8 | * @returns {boolean} Returns `true` if the entry was removed, else `false`. |
| 9 | */ | 9 | */ |
| 10 | function stackDelete(key) { | 10 | function stackDelete(key) { |
| 11 | return this.__data__['delete'](key); | 11 | var data = this.__data__, |
| 12 | result = data['delete'](key); | ||
| 13 | |||
| 14 | this.size = data.size; | ||
| 15 | return result; | ||
| 12 | } | 16 | } |
| 13 | 17 | ||
| 14 | module.exports = stackDelete; | 18 | module.exports = stackDelete; |
@@ -1,8 +1,6 @@ | |||
| 1 | var constant = require('./constant'), | ||
| 2 | defineProperty = require('./_defineProperty'), | ||
| 3 | getWrapDetails = require('./_getWrapDetails'), | ||
| 4 | identity = require('./identity'), | 1 | var getWrapDetails = require('./_getWrapDetails'), |
| 5 | insertWrapDetails = require('./_insertWrapDetails'), | 2 | insertWrapDetails = require('./_insertWrapDetails'), |
| 3 | setToString = require('./_setToString'), | ||
| 6 | updateWrapDetails = require('./_updateWrapDetails'); | 4 | updateWrapDetails = require('./_updateWrapDetails'); |
| 7 | 5 | ||
| 8 | /** | 6 | /** |
@@ -15,13 +13,9 @@ | |||
| 15 | * @param {number} bitmask The bitmask flags. See `createWrap` for more details. | 13 | * @param {number} bitmask The bitmask flags. See `createWrap` for more details. |
| 16 | * @returns {Function} Returns `wrapper`. | 14 | * @returns {Function} Returns `wrapper`. |
| 17 | */ | 15 | */ |
| 18 | var setWrapToString = !defineProperty ? identity : function(wrapper, reference, bitmask) { | 16 | function setWrapToString(wrapper, reference, bitmask) { |
| 19 | var source = (reference + ''); | 17 | var source = (reference + ''); |
| 20 | return defineProperty(wrapper, 'toString', { | ||
| 21 | 'configurable': true, | ||
| 22 | 'enumerable': false, | ||
| 23 | 'value': constant(insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask))) | ||
| 24 | }); | ||
| 25 | }; | 18 | return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask))); |
| 19 | } | ||
| 26 | 20 | ||
| 27 | module.exports = setWrapToString; | 21 | module.exports = setWrapToString; |
@@ -1,10 +1,6 @@ | |||
| 1 | var baseSetData = require('./_baseSetData'), | 1 | var baseSetData = require('./_baseSetData'), |
| 2 | now = require('./now'); | 2 | shortOut = require('./_shortOut'); |
| 3 | 3 | ||
| 4 | /** Used to detect hot functions by number of calls within a span of milliseconds. */ | ||
| 5 | var HOT_COUNT = 150, | ||
| 6 | HOT_SPAN = 16; | ||
| 7 | |||
| 8 | /** | 4 | /** |
| 9 | * Sets metadata for `func`. | 5 | * Sets metadata for `func`. |
| 10 | * | 6 | * |
@@ -19,24 +15,6 @@ | |||
| 19 | * @param {*} data The metadata. | 15 | * @param {*} data The metadata. |
| 20 | * @returns {Function} Returns `func`. | 16 | * @returns {Function} Returns `func`. |
| 21 | */ | 17 | */ |
| 22 | var setData = (function() { | ||
| 23 | var count = 0, | ||
| 24 | lastCalled = 0; | 18 | var setData = shortOut(baseSetData); |
| 25 | 19 | ||
| 26 | return function(key, value) { | ||
| 27 | var stamp = now(), | ||
| 28 | remaining = HOT_SPAN - (stamp - lastCalled); | ||
| 29 | |||
| 30 | lastCalled = stamp; | ||
| 31 | if (remaining > 0) { | ||
| 32 | if (++count >= HOT_COUNT) { | ||
| 33 | return key; | ||
| 34 | } | ||
| 35 | } else { | ||
| 36 | count = 0; | ||
| 37 | } | ||
| 38 | return baseSetData(key, value); | ||
| 39 | }; | ||
| 40 | }()); | ||
| 41 | |||
| 42 | module.exports = setData; | 20 | module.exports = setData; |
@@ -23,7 +23,7 @@ | |||
| 23 | * @see _.forEachRight | 23 | * @see _.forEachRight |
| 24 | * @example | 24 | * @example |
| 25 | * | 25 | * |
| 26 | * _([1, 2]).forEach(function(value) { | 26 | * _.forEach([1, 2], function(value) { |
| 27 | * console.log(value); | 27 | * console.log(value); |
| 28 | * }); | 28 | * }); |
| 29 | * // => Logs `1` then `2`. | 29 | * // => Logs `1` then `2`. |
@@ -11,7 +11,11 @@ | |||
| 11 | * @returns {Object} Returns the map cache instance. | 11 | * @returns {Object} Returns the map cache instance. |
| 12 | */ | 12 | */ |
| 13 | function mapCacheSet(key, value) { | 13 | function mapCacheSet(key, value) { |
| 14 | getMapData(this, key).set(key, value); | 14 | var data = getMapData(this, key), |
| 15 | size = data.size; | ||
| 16 | |||
| 17 | data.set(key, value); | ||
| 18 | this.size += data.size == size ? 0 : 1; | ||
| 15 | return this; | 19 | return this; |
| 16 | } | 20 | } |
| 17 | 21 | ||
@@ -1,4 +1,5 @@ | |||
| 1 | var createAggregator = require('./_createAggregator'); | 1 | var baseAssignValue = require('./_baseAssignValue'), |
| 2 | createAggregator = require('./_createAggregator'); | ||
| 2 | 3 | ||
| 3 | /** Used for built-in method references. */ | 4 | /** Used for built-in method references. */ |
| 4 | var objectProto = Object.prototype; | 5 | var objectProto = Object.prototype; |
@@ -34,7 +35,7 @@ | |||
| 34 | if (hasOwnProperty.call(result, key)) { | 35 | if (hasOwnProperty.call(result, key)) { |
| 35 | result[key].push(value); | 36 | result[key].push(value); |
| 36 | } else { | 37 | } else { |
| 37 | result[key] = [value]; | 38 | baseAssignValue(result, key, [value]); |
| 38 | } | 39 | } |
| 39 | }); | 40 | }); |
| 40 | 41 | ||
@@ -10,7 +10,9 @@ | |||
| 10 | * @returns {boolean} Returns `true` if the entry was removed, else `false`. | 10 | * @returns {boolean} Returns `true` if the entry was removed, else `false`. |
| 11 | */ | 11 | */ |
| 12 | function mapCacheDelete(key) { | 12 | function mapCacheDelete(key) { |
| 13 | return getMapData(this, key)['delete'](key); | 13 | var result = getMapData(this, key)['delete'](key); |
| 14 | this.size -= result ? 1 : 0; | ||
| 15 | return result; | ||
| 14 | } | 16 | } |
| 15 | 17 | ||
| 16 | module.exports = mapCacheDelete; | 18 | module.exports = mapCacheDelete; |
@@ -6,8 +6,8 @@ | |||
| 6 | /** | 6 | /** |
| 7 | * Creates an array of unique values that are included in all given arrays | 7 | * Creates an array of unique values that are included in all given arrays |
| 8 | * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) | 8 | * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) |
| 9 | * for equality comparisons. The order of result values is determined by the | ||
| 10 | * order they occur in the first array. | 9 | * for equality comparisons. The order and references of result values are |
| 10 | * determined by the first array. | ||
| 11 | * | 11 | * |
| 12 | * @static | 12 | * @static |
| 13 | * @memberOf _ | 13 | * @memberOf _ |
@@ -8,8 +8,9 @@ | |||
| 8 | /** | 8 | /** |
| 9 | * This method is like `_.intersection` except that it accepts `iteratee` | 9 | * This method is like `_.intersection` except that it accepts `iteratee` |
| 10 | * which is invoked for each element of each `arrays` to generate the criterion | 10 | * which is invoked for each element of each `arrays` to generate the criterion |
| 11 | * by which they're compared. Result values are chosen from the first array. | ||
| 12 | * The iteratee is invoked with one argument: (value). | 11 | * by which they're compared. The order and references of result values are |
| 12 | * determined by the first array. The iteratee is invoked with one argument: | ||
| 13 | * (value). | ||
| 13 | * | 14 | * |
| 14 | * @static | 15 | * @static |
| 15 | * @memberOf _ | 16 | * @memberOf _ |
@@ -6,9 +6,9 @@ | |||
| 6 | 6 | ||
| 7 | /** | 7 | /** |
| 8 | * This method is like `_.intersection` except that it accepts `comparator` | 8 | * This method is like `_.intersection` except that it accepts `comparator` |
| 9 | * which is invoked to compare elements of `arrays`. Result values are chosen | ||
| 10 | * from the first array. The comparator is invoked with two arguments: | ||
| 11 | * (arrVal, othVal). | 9 | * which is invoked to compare elements of `arrays`. The order and references |
| 10 | * of result values are determined by the first array. The comparator is | ||
| 11 | * invoked with two arguments: (arrVal, othVal). | ||
| 12 | * | 12 | * |
| 13 | * @static | 13 | * @static |
| 14 | * @memberOf _ | 14 | * @memberOf _ |
@@ -10,9 +10,11 @@ | |||
| 10 | * @returns {string} Returns the modified source. | 10 | * @returns {string} Returns the modified source. |
| 11 | */ | 11 | */ |
| 12 | function insertWrapDetails(source, details) { | 12 | function insertWrapDetails(source, details) { |
| 13 | var length = details.length, | ||
| 14 | lastIndex = length - 1; | ||
| 15 | 13 | var length = details.length; | |
| 14 | if (!length) { | ||
| 15 | return source; | ||
| 16 | } | ||
| 17 | var lastIndex = length - 1; | ||
| 16 | details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex]; | 18 | details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex]; |
| 17 | details = details.join(length > 2 ? ', ' : ' '); | 19 | details = details.join(length > 2 ? ', ' : ' '); |
| 18 | return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n'); | 20 | return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n'); |
@@ -19,7 +19,7 @@ | |||
| 19 | * // => false | 19 | * // => false |
| 20 | */ | 20 | */ |
| 21 | function isElement(value) { | 21 | function isElement(value) { |
| 22 | return !!value && value.nodeType === 1 && isObjectLike(value) && !isPlainObject(value); | 22 | return value != null && value.nodeType === 1 && isObjectLike(value) && !isPlainObject(value); |
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | module.exports = isElement; | 25 | module.exports = isElement; |
@@ -15,6 +15,7 @@ | |||
| 15 | */ | 15 | */ |
| 16 | function hashSet(key, value) { | 16 | function hashSet(key, value) { |
| 17 | var data = this.__data__; | 17 | var data = this.__data__; |
| 18 | this.size += this.has(key) ? 0 : 1; | ||
| 18 | data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; | 19 | data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; |
| 19 | return this; | 20 | return this; |
| 20 | } | 21 | } |
@@ -16,12 +16,6 @@ | |||
| 16 | /** Used to check objects for own properties. */ | 16 | /** Used to check objects for own properties. */ |
| 17 | var hasOwnProperty = objectProto.hasOwnProperty; | 17 | var hasOwnProperty = objectProto.hasOwnProperty; |
| 18 | 18 | ||
| 19 | /** Built-in value references. */ | ||
| 20 | var propertyIsEnumerable = objectProto.propertyIsEnumerable; | ||
| 21 | |||
| 22 | /** Detect if properties shadowing those on `Object.prototype` are non-enumerable. */ | ||
| 23 | var nonEnumShadows = !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf'); | ||
| 24 | |||
| 25 | /** | 19 | /** |
| 26 | * Checks if `value` is an empty object, collection, map, or set. | 20 | * Checks if `value` is an empty object, collection, map, or set. |
| 27 | * | 21 | * |
@@ -65,7 +59,7 @@ | |||
| 65 | if (tag == mapTag || tag == setTag) { | 59 | if (tag == mapTag || tag == setTag) { |
| 66 | return !value.size; | 60 | return !value.size; |
| 67 | } | 61 | } |
| 68 | if (nonEnumShadows || isPrototype(value)) { | 62 | if (isPrototype(value)) { |
| 69 | return !nativeKeys(value).length; | 63 | return !nativeKeys(value).length; |
| 70 | } | 64 | } |
| 71 | for (var key in value) { | 65 | for (var key in value) { |
@@ -9,7 +9,9 @@ | |||
| 9 | * @returns {boolean} Returns `true` if the entry was removed, else `false`. | 9 | * @returns {boolean} Returns `true` if the entry was removed, else `false`. |
| 10 | */ | 10 | */ |
| 11 | function hashDelete(key) { | 11 | function hashDelete(key) { |
| 12 | return this.has(key) && delete this.__data__[key]; | 12 | var result = this.has(key) && delete this.__data__[key]; |
| 13 | this.size -= result ? 1 : 0; | ||
| 14 | return result; | ||
| 13 | } | 15 | } |
| 14 | 16 | ||
| 15 | module.exports = hashDelete; | 17 | module.exports = hashDelete; |
@@ -18,9 +18,9 @@ | |||
| 18 | function hasPath(object, path, hasFunc) { | 18 | function hasPath(object, path, hasFunc) { |
| 19 | path = isKey(path, object) ? [path] : castPath(path); | 19 | path = isKey(path, object) ? [path] : castPath(path); |
| 20 | 20 | ||
| 21 | var result, | ||
| 22 | index = -1, | ||
| 23 | length = path.length; | 21 | var index = -1, |
| 22 | length = path.length, | ||
| 23 | result = false; | ||
| 24 | 24 | ||
| 25 | while (++index < length) { | 25 | while (++index < length) { |
| 26 | var key = toKey(path[index]); | 26 | var key = toKey(path[index]); |
@@ -29,10 +29,10 @@ | |||
| 29 | } | 29 | } |
| 30 | object = object[key]; | 30 | object = object[key]; |
| 31 | } | 31 | } |
| 32 | if (result) { | 32 | if (result || ++index != length) { |
| 33 | return result; | 33 | return result; |
| 34 | } | 34 | } |
| 35 | var length = object ? object.length : 0; | 35 | length = object ? object.length : 0; |
| 36 | return !!length && isLength(length) && isIndex(key, length) && | 36 | return !!length && isLength(length) && isIndex(key, length) && |
| 37 | (isArray(object) || isArguments(object)); | 37 | (isArray(object) || isArguments(object)); |
| 38 | } | 38 | } |
@@ -41,8 +41,7 @@ | |||
| 41 | */ | 41 | */ |
| 42 | var getTag = baseGetTag; | 42 | var getTag = baseGetTag; |
| 43 | 43 | ||
| 44 | // Fallback for data views, maps, sets, and weak maps in IE 11, | ||
| 45 | // for data views in Edge < 14, and promises in Node.js. | 44 | // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6. |
| 46 | if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || | 45 | if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || |
| 47 | (Map && getTag(new Map) != mapTag) || | 46 | (Map && getTag(new Map) != mapTag) || |
| 48 | (Promise && getTag(Promise.resolve()) != promiseTag) || | 47 | (Promise && getTag(Promise.resolve()) != promiseTag) || |
@@ -25,7 +25,7 @@ | |||
| 25 | */ | 25 | */ |
| 26 | function isObject(value) { | 26 | function isObject(value) { |
| 27 | var type = typeof value; | 27 | var type = typeof value; |
| 28 | return !!value && (type == 'object' || type == 'function'); | 28 | return value != null && (type == 'object' || type == 'function'); |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | module.exports = isObject; | 31 | module.exports = isObject; |
@@ -1,5 +1,4 @@ | |||
| 1 | var getPrototype = require('./_getPrototype'), | 1 | var getPrototype = require('./_getPrototype'), |
| 2 | isHostObject = require('./_isHostObject'), | ||
| 3 | isObjectLike = require('./isObjectLike'); | 2 | isObjectLike = require('./isObjectLike'); |
| 4 | 3 | ||
| 5 | /** `Object#toString` result references. */ | 4 | /** `Object#toString` result references. */ |
@@ -54,8 +53,7 @@ | |||
| 54 | * // => true | 53 | * // => true |
| 55 | */ | 54 | */ |
| 56 | function isPlainObject(value) { | 55 | function isPlainObject(value) { |
| 57 | if (!isObjectLike(value) || | ||
| 58 | objectToString.call(value) != objectTag || isHostObject(value)) { | 56 | if (!isObjectLike(value) || objectToString.call(value) != objectTag) { |
| 59 | return false; | 57 | return false; |
| 60 | } | 58 | } |
| 61 | var proto = getPrototype(value); | 59 | var proto = getPrototype(value); |
@@ -1,5 +1,6 @@ | |||
| 1 | var SetCache = require('./_SetCache'), | 1 | var SetCache = require('./_SetCache'), |
| 2 | arraySome = require('./_arraySome'); | 2 | arraySome = require('./_arraySome'), |
| 3 | cacheHas = require('./_cacheHas'); | ||
| 3 | 4 | ||
| 4 | /** Used to compose bitmasks for comparison styles. */ | 5 | /** Used to compose bitmasks for comparison styles. */ |
| 5 | var UNORDERED_COMPARE_FLAG = 1, | 6 | var UNORDERED_COMPARE_FLAG = 1, |
@@ -59,9 +60,9 @@ | |||
| 59 | // Recursively compare arrays (susceptible to call stack limits). | 60 | // Recursively compare arrays (susceptible to call stack limits). |
| 60 | if (seen) { | 61 | if (seen) { |
| 61 | if (!arraySome(other, function(othValue, othIndex) { | 62 | if (!arraySome(other, function(othValue, othIndex) { |
| 62 | if (!seen.has(othIndex) && | 63 | if (!cacheHas(seen, othIndex) && |
| 63 | (arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) { | 64 | (arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) { |
| 64 | return seen.add(othIndex); | 65 | return seen.push(othIndex); |
| 65 | } | 66 | } |
| 66 | })) { | 67 | })) { |
| 67 | result = false; | 68 | result = false; |
@@ -55,7 +55,7 @@ | |||
| 55 | '\u017a': 'z', '\u017c': 'z', '\u017e': 'z', | 55 | '\u017a': 'z', '\u017c': 'z', '\u017e': 'z', |
| 56 | '\u0132': 'IJ', '\u0133': 'ij', | 56 | '\u0132': 'IJ', '\u0133': 'ij', |
| 57 | '\u0152': 'Oe', '\u0153': 'oe', | 57 | '\u0152': 'Oe', '\u0153': 'oe', |
| 58 | '\u0149': "'n", '\u017f': 'ss' | 58 | '\u0149': "'n", '\u017f': 's' |
| 59 | }; | 59 | }; |
| 60 | 60 | ||
| 61 | /** | 61 | /** |
@@ -1,4 +1,5 @@ | |||
| 1 | var createAggregator = require('./_createAggregator'); | 1 | var baseAssignValue = require('./_baseAssignValue'), |
| 2 | createAggregator = require('./_createAggregator'); | ||
| 2 | 3 | ||
| 3 | /** | 4 | /** |
| 4 | * Creates an object composed of keys generated from the results of running | 5 | * Creates an object composed of keys generated from the results of running |
@@ -30,7 +31,7 @@ | |||
| 30 | * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } } | 31 | * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } } |
| 31 | */ | 32 | */ |
| 32 | var keyBy = createAggregator(function(result, value, key) { | 33 | var keyBy = createAggregator(function(result, value, key) { |
| 33 | result[key] = value; | 34 | baseAssignValue(result, key, value); |
| 34 | }); | 35 | }); |
| 35 | 36 | ||
| 36 | module.exports = keyBy; | 37 | module.exports = keyBy; |
@@ -1,5 +1,6 @@ | |||
| 1 | var baseFindIndex = require('./_baseFindIndex'), | 1 | var baseFindIndex = require('./_baseFindIndex'), |
| 2 | baseIsNaN = require('./_baseIsNaN'), | 2 | baseIsNaN = require('./_baseIsNaN'), |
| 3 | strictLastIndexOf = require('./_strictLastIndexOf'), | ||
| 3 | toInteger = require('./toInteger'); | 4 | toInteger = require('./toInteger'); |
| 4 | 5 | ||
| 5 | /* Built-in method references for those with the same name as other `lodash` methods. */ | 6 | /* Built-in method references for those with the same name as other `lodash` methods. */ |
@@ -35,21 +36,11 @@ | |||
| 35 | var index = length; | 36 | var index = length; |
| 36 | if (fromIndex !== undefined) { | 37 | if (fromIndex !== undefined) { |
| 37 | index = toInteger(fromIndex); | 38 | index = toInteger(fromIndex); |
| 38 | index = ( | ||
| 39 | index < 0 | ||
| 40 | ? nativeMax(length + index, 0) | ||
| 41 | : nativeMin(index, length - 1) | ||
| 42 | ) + 1; | 39 | index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1); |
| 43 | } | 40 | } |
| 44 | if (value !== value) { | ||
| 45 | return baseFindIndex(array, baseIsNaN, index - 1, true); | ||
| 46 | } | ||
| 47 | while (index--) { | ||
| 48 | if (array[index] === value) { | ||
| 49 | return index; | ||
| 50 | } | ||
| 51 | } | ||
| 52 | return -1; | 41 | return value === value |
| 42 | ? strictLastIndexOf(array, value, index) | ||
| 43 | : baseFindIndex(array, baseIsNaN, index, true); | ||
| 53 | } | 44 | } |
| 54 | 45 | ||
| 55 | module.exports = lastIndexOf; | 46 | module.exports = lastIndexOf; |
@@ -1,10 +1,9 @@ | |||
| 1 | var apply = require('./_apply'), | 1 | var apply = require('./_apply'), |
| 2 | arrayMap = require('./_arrayMap'), | 2 | arrayMap = require('./_arrayMap'), |
| 3 | baseFlatten = require('./_baseFlatten'), | ||
| 4 | baseIteratee = require('./_baseIteratee'), | 3 | baseIteratee = require('./_baseIteratee'), |
| 5 | baseRest = require('./_baseRest'), | 4 | baseRest = require('./_baseRest'), |
| 6 | baseUnary = require('./_baseUnary'), | 5 | baseUnary = require('./_baseUnary'), |
| 7 | isArray = require('./isArray'); | 6 | flatRest = require('./_flatRest'); |
| 8 | 7 | ||
| 9 | /** | 8 | /** |
| 10 | * Creates a function like `_.over`. | 9 | * Creates a function like `_.over`. |
@@ -14,11 +13,8 @@ | |||
| 14 | * @returns {Function} Returns the new over function. | 13 | * @returns {Function} Returns the new over function. |
| 15 | */ | 14 | */ |
| 16 | function createOver(arrayFunc) { | 15 | function createOver(arrayFunc) { |
| 17 | return baseRest(function(iteratees) { | ||
| 18 | iteratees = (iteratees.length == 1 && isArray(iteratees[0])) | ||
| 19 | ? arrayMap(iteratees[0], baseUnary(baseIteratee)) | ||
| 20 | : arrayMap(baseFlatten(iteratees, 1), baseUnary(baseIteratee)); | ||
| 21 | 16 | return flatRest(function(iteratees) { | |
| 17 | iteratees = arrayMap(iteratees, baseUnary(baseIteratee)); | ||
| 22 | return baseRest(function(args) { | 18 | return baseRest(function(args) { |
| 23 | var thisArg = this; | 19 | var thisArg = this; |
| 24 | return arrayFunc(iteratees, function(iteratee) { | 20 | return arrayFunc(iteratees, function(iteratee) { |
@@ -1,6 +1,5 @@ | |||
| 1 | var LodashWrapper = require('./_LodashWrapper'), | 1 | var LodashWrapper = require('./_LodashWrapper'), |
| 2 | baseFlatten = require('./_baseFlatten'), | ||
| 3 | baseRest = require('./_baseRest'), | 2 | flatRest = require('./_flatRest'), |
| 4 | getData = require('./_getData'), | 3 | getData = require('./_getData'), |
| 5 | getFuncName = require('./_getFuncName'), | 4 | getFuncName = require('./_getFuncName'), |
| 6 | isArray = require('./isArray'), | 5 | isArray = require('./isArray'), |
@@ -26,9 +25,7 @@ | |||
| 26 | * @returns {Function} Returns the new flow function. | 25 | * @returns {Function} Returns the new flow function. |
| 27 | */ | 26 | */ |
| 28 | function createFlow(fromRight) { | 27 | function createFlow(fromRight) { |
| 29 | return baseRest(function(funcs) { | ||
| 30 | funcs = baseFlatten(funcs, 1); | ||
| 31 | 28 | return flatRest(function(funcs) { | |
| 32 | var length = funcs.length, | 29 | var length = funcs.length, |
| 33 | index = length, | 30 | index = length, |
| 34 | prereq = LodashWrapper.prototype.thru; | 31 | prereq = LodashWrapper.prototype.thru; |
@@ -1,4 +1,5 @@ | |||
| 1 | var baseForOwn = require('./_baseForOwn'), | 1 | var baseAssignValue = require('./_baseAssignValue'), |
| 2 | baseForOwn = require('./_baseForOwn'), | ||
| 2 | baseIteratee = require('./_baseIteratee'); | 3 | baseIteratee = require('./_baseIteratee'); |
| 3 | 4 | ||
| 4 | /** | 5 | /** |
@@ -27,7 +28,7 @@ | |||
| 27 | iteratee = baseIteratee(iteratee, 3); | 28 | iteratee = baseIteratee(iteratee, 3); |
| 28 | 29 | ||
| 29 | baseForOwn(object, function(value, key, object) { | 30 | baseForOwn(object, function(value, key, object) { |
| 30 | result[iteratee(value, key, object)] = value; | 31 | baseAssignValue(result, iteratee(value, key, object), value); |
| 31 | }); | 32 | }); |
| 32 | return result; | 33 | return result; |
| 33 | } | 34 | } |
@@ -1,4 +1,5 @@ | |||
| 1 | var baseForOwn = require('./_baseForOwn'), | 1 | var baseAssignValue = require('./_baseAssignValue'), |
| 2 | baseForOwn = require('./_baseForOwn'), | ||
| 2 | baseIteratee = require('./_baseIteratee'); | 3 | baseIteratee = require('./_baseIteratee'); |
| 3 | 4 | ||
| 4 | /** | 5 | /** |
@@ -34,7 +35,7 @@ | |||
| 34 | iteratee = baseIteratee(iteratee, 3); | 35 | iteratee = baseIteratee(iteratee, 3); |
| 35 | 36 | ||
| 36 | baseForOwn(object, function(value, key, object) { | 37 | baseForOwn(object, function(value, key, object) { |
| 37 | result[key] = iteratee(value, key, object); | 38 | baseAssignValue(result, key, iteratee(value, key, object)); |
| 38 | }); | 39 | }); |
| 39 | return result; | 40 | return result; |
| 40 | } | 41 | } |
@@ -60,14 +60,14 @@ | |||
| 60 | return cache.get(key); | 60 | return cache.get(key); |
| 61 | } | 61 | } |
| 62 | var result = func.apply(this, args); | 62 | var result = func.apply(this, args); |
| 63 | memoized.cache = cache.set(key, result); | 63 | memoized.cache = cache.set(key, result) || cache; |
| 64 | return result; | 64 | return result; |
| 65 | }; | 65 | }; |
| 66 | memoized.cache = new (memoize.Cache || MapCache); | 66 | memoized.cache = new (memoize.Cache || MapCache); |
| 67 | return memoized; | 67 | return memoized; |
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | // Assign cache to `_.memoize`. | 70 | // Expose `MapCache`. |
| 71 | memoize.Cache = MapCache; | 71 | memoize.Cache = MapCache; |
| 72 | 72 | ||
| 73 | module.exports = memoize; | 73 | module.exports = memoize; |
@@ -5,7 +5,7 @@ | |||
| 5 | * This method is like `_.merge` except that it accepts `customizer` which | 5 | * This method is like `_.merge` except that it accepts `customizer` which |
| 6 | * is invoked to produce the merged values of the destination and source | 6 | * is invoked to produce the merged values of the destination and source |
| 7 | * properties. If `customizer` returns `undefined`, merging is handled by the | 7 | * properties. If `customizer` returns `undefined`, merging is handled by the |
| 8 | * method instead. The `customizer` is invoked with seven arguments: | 8 | * method instead. The `customizer` is invoked with six arguments: |
| 9 | * (objValue, srcValue, key, object, source, stack). | 9 | * (objValue, srcValue, key, object, source, stack). |
| 10 | * | 10 | * |
| 11 | * **Note:** This method mutates `object`. | 11 | * **Note:** This method mutates `object`. |
@@ -1,4 +1,5 @@ | |||
| 1 | var assignValue = require('./_assignValue'); | 1 | var assignValue = require('./_assignValue'), |
| 2 | baseAssignValue = require('./_baseAssignValue'); | ||
| 2 | 3 | ||
| 3 | /** | 4 | /** |
| 4 | * Copies properties of `source` to `object`. | 5 | * Copies properties of `source` to `object`. |
@@ -11,6 +12,7 @@ | |||
| 11 | * @returns {Object} Returns `object`. | 12 | * @returns {Object} Returns `object`. |
| 12 | */ | 13 | */ |
| 13 | function copyObject(source, props, object, customizer) { | 14 | function copyObject(source, props, object, customizer) { |
| 15 | var isNew = !object; | ||
| 14 | object || (object = {}); | 16 | object || (object = {}); |
| 15 | 17 | ||
| 16 | var index = -1, | 18 | var index = -1, |
@@ -23,7 +25,14 @@ | |||
| 23 | ? customizer(object[key], source[key], key, object, source) | 25 | ? customizer(object[key], source[key], key, object, source) |
| 24 | : undefined; | 26 | : undefined; |
| 25 | 27 | ||
| 26 | assignValue(object, key, newValue === undefined ? source[key] : newValue); | 28 | if (newValue === undefined) { |
| 29 | newValue = source[key]; | ||
| 30 | } | ||
| 31 | if (isNew) { | ||
| 32 | baseAssignValue(object, key, newValue); | ||
| 33 | } else { | ||
| 34 | assignValue(object, key, newValue); | ||
| 35 | } | ||
| 27 | } | 36 | } |
| 28 | return object; | 37 | return object; |
| 29 | } | 38 | } |
@@ -1,8 +1,7 @@ | |||
| 1 | var arrayMap = require('./_arrayMap'), | 1 | var arrayMap = require('./_arrayMap'), |
| 2 | baseDifference = require('./_baseDifference'), | 2 | baseDifference = require('./_baseDifference'), |
| 3 | baseFlatten = require('./_baseFlatten'), | ||
| 4 | basePick = require('./_basePick'), | 3 | basePick = require('./_basePick'), |
| 5 | baseRest = require('./_baseRest'), | 4 | flatRest = require('./_flatRest'), |
| 6 | getAllKeysIn = require('./_getAllKeysIn'), | 5 | getAllKeysIn = require('./_getAllKeysIn'), |
| 7 | toKey = require('./_toKey'); | 6 | toKey = require('./_toKey'); |
| 8 | 7 | ||
@@ -25,11 +24,11 @@ | |||
| 25 | * _.omit(object, ['a', 'c']); | 24 | * _.omit(object, ['a', 'c']); |
| 26 | * // => { 'b': '2' } | 25 | * // => { 'b': '2' } |
| 27 | */ | 26 | */ |
| 28 | var omit = baseRest(function(object, props) { | 27 | var omit = flatRest(function(object, props) { |
| 29 | if (object == null) { | 28 | if (object == null) { |
| 30 | return {}; | 29 | return {}; |
| 31 | } | 30 | } |
| 32 | props = arrayMap(baseFlatten(props, 1), toKey); | 31 | props = arrayMap(props, toKey); |
| 33 | return basePick(object, baseDifference(getAllKeysIn(object), props)); | 32 | return basePick(object, baseDifference(getAllKeysIn(object), props)); |
| 34 | }); | 33 | }); |
| 35 | 34 | ||
@@ -4,6 +4,7 @@ | |||
| 4 | baseIteratee = require('./_baseIteratee'), | 4 | baseIteratee = require('./_baseIteratee'), |
| 5 | baseRest = require('./_baseRest'), | 5 | baseRest = require('./_baseRest'), |
| 6 | baseUnary = require('./_baseUnary'), | 6 | baseUnary = require('./_baseUnary'), |
| 7 | castRest = require('./_castRest'), | ||
| 7 | isArray = require('./isArray'); | 8 | isArray = require('./isArray'); |
| 8 | 9 | ||
| 9 | /* Built-in method references for those with the same name as other `lodash` methods. */ | 10 | /* Built-in method references for those with the same name as other `lodash` methods. */ |
@@ -40,7 +41,7 @@ | |||
| 40 | * func(10, 5); | 41 | * func(10, 5); |
| 41 | * // => [100, 10] | 42 | * // => [100, 10] |
| 42 | */ | 43 | */ |
| 43 | var overArgs = baseRest(function(func, transforms) { | 44 | var overArgs = castRest(function(func, transforms) { |
| 44 | transforms = (transforms.length == 1 && isArray(transforms[0])) | 45 | transforms = (transforms.length == 1 && isArray(transforms[0])) |
| 45 | ? arrayMap(transforms[0], baseUnary(baseIteratee)) | 46 | ? arrayMap(transforms[0], baseUnary(baseIteratee)) |
| 46 | : arrayMap(baseFlatten(transforms, 1), baseUnary(baseIteratee)); | 47 | : arrayMap(baseFlatten(transforms, 1), baseUnary(baseIteratee)); |
@@ -26,17 +26,18 @@ | |||
| 26 | * // => [1] | 26 | * // => [1] |
| 27 | */ | 27 | */ |
| 28 | function concat() { | 28 | function concat() { |
| 29 | var length = arguments.length, | ||
| 30 | args = Array(length ? length - 1 : 0), | 29 | var length = arguments.length; |
| 30 | if (!length) { | ||
| 31 | return []; | ||
| 32 | } | ||
| 33 | var args = Array(length - 1), | ||
| 31 | array = arguments[0], | 34 | array = arguments[0], |
| 32 | index = length; | 35 | index = length; |
| 33 | 36 | ||
| 34 | while (index--) { | 37 | while (index--) { |
| 35 | args[index - 1] = arguments[index]; | 38 | args[index - 1] = arguments[index]; |
| 36 | } | 39 | } |
| 37 | return length | ||
| 38 | ? arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1)) | ||
| 39 | : []; | 40 | return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1)); |
| 40 | } | 41 | } |
| 41 | 42 | ||
| 42 | module.exports = concat; | 43 | module.exports = concat; |
@@ -1,12 +1,6 @@ | |||
| 1 | var root = require('./_root'), | 1 | var root = require('./_root'), |
| 2 | toString = require('./toString'); | 2 | toString = require('./toString'); |
| 3 | 3 | ||
| 4 | /** Used to match leading and trailing whitespace. */ | ||
| 5 | var reTrim = /^\s+|\s+$/g; | ||
| 6 | |||
| 7 | /** Used to detect hexadecimal string values. */ | ||
| 8 | var reHasHexPrefix = /^0x/i; | ||
| 9 | |||
| 10 | /* Built-in method references for those with the same name as other `lodash` methods. */ | 4 | /* Built-in method references for those with the same name as other `lodash` methods. */ |
| 11 | var nativeParseInt = root.parseInt; | 5 | var nativeParseInt = root.parseInt; |
| 12 | 6 | ||
@@ -35,15 +29,12 @@ | |||
| 35 | * // => [6, 8, 10] | 29 | * // => [6, 8, 10] |
| 36 | */ | 30 | */ |
| 37 | function parseInt(string, radix, guard) { | 31 | function parseInt(string, radix, guard) { |
| 38 | // Chrome fails to trim leading <BOM> whitespace characters. | ||
| 39 | // See https://bugs.chromium.org/p/v8/issues/detail?id=3109 for more details. | ||
| 40 | if (guard || radix == null) { | 32 | if (guard || radix == null) { |
| 41 | radix = 0; | 33 | radix = 0; |
| 42 | } else if (radix) { | 34 | } else if (radix) { |
| 43 | radix = +radix; | 35 | radix = +radix; |
| 44 | } | 36 | } |
| 45 | string = toString(string).replace(reTrim, ''); | ||
| 46 | return nativeParseInt(string, radix || (reHasHexPrefix.test(string) ? 16 : 10)); | 37 | return nativeParseInt(toString(string), radix || 0); |
| 47 | } | 38 | } |
| 48 | 39 | ||
| 49 | module.exports = parseInt; | 40 | module.exports = parseInt; |
@@ -1,7 +1,6 @@ | |||
| 1 | var arrayMap = require('./_arrayMap'), | 1 | var arrayMap = require('./_arrayMap'), |
| 2 | baseFlatten = require('./_baseFlatten'), | ||
| 3 | basePick = require('./_basePick'), | 2 | basePick = require('./_basePick'), |
| 4 | baseRest = require('./_baseRest'), | 3 | flatRest = require('./_flatRest'), |
| 5 | toKey = require('./_toKey'); | 4 | toKey = require('./_toKey'); |
| 6 | 5 | ||
| 7 | /** | 6 | /** |
@@ -21,8 +20,8 @@ | |||
| 21 | * _.pick(object, ['a', 'c']); | 20 | * _.pick(object, ['a', 'c']); |
| 22 | * // => { 'a': 1, 'c': 3 } | 21 | * // => { 'a': 1, 'c': 3 } |
| 23 | */ | 22 | */ |
| 24 | var pick = baseRest(function(object, props) { | ||
| 25 | return object == null ? {} : basePick(object, arrayMap(baseFlatten(props, 1), toKey)); | 23 | var pick = flatRest(function(object, props) { |
| 24 | return object == null ? {} : basePick(object, arrayMap(props, toKey)); | ||
| 26 | }); | 25 | }); |
| 27 | 26 | ||
| 28 | module.exports = pick; | 27 | module.exports = pick; |
@@ -1,9 +1,8 @@ | |||
| 1 | var arrayMap = require('./_arrayMap'), | 1 | var arrayMap = require('./_arrayMap'), |
| 2 | baseAt = require('./_baseAt'), | 2 | baseAt = require('./_baseAt'), |
| 3 | baseFlatten = require('./_baseFlatten'), | ||
| 4 | basePullAt = require('./_basePullAt'), | 3 | basePullAt = require('./_basePullAt'), |
| 5 | baseRest = require('./_baseRest'), | ||
| 6 | compareAscending = require('./_compareAscending'), | 4 | compareAscending = require('./_compareAscending'), |
| 5 | flatRest = require('./_flatRest'), | ||
| 7 | isIndex = require('./_isIndex'); | 6 | isIndex = require('./_isIndex'); |
| 8 | 7 | ||
| 9 | /** | 8 | /** |
@@ -30,9 +29,7 @@ | |||
| 30 | * console.log(pulled); | 29 | * console.log(pulled); |
| 31 | * // => ['b', 'd'] | 30 | * // => ['b', 'd'] |
| 32 | */ | 31 | */ |
| 33 | var pullAt = baseRest(function(array, indexes) { | ||
| 34 | indexes = baseFlatten(indexes, 1); | ||
| 35 | 32 | var pullAt = flatRest(function(array, indexes) { | |
| 36 | var length = array ? array.length : 0, | 33 | var length = array ? array.length : 0, |
| 37 | result = baseAt(array, indexes); | 34 | result = baseAt(array, indexes); |
| 38 | 35 | ||