diff --git a/README.md b/README.md index 2419f752a..c2a951fed 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# lodash-es v4.17.1 +# lodash-es v4.17.2 The [Lodash](https://lodash.com/) library exported as [ES](http://www.ecma-international.org/ecma-262/6.0/) modules. @@ -7,4 +7,4 @@ Generated using [lodash-cli](https://www.npmjs.com/package/lodash-cli): $ lodash modularize exports=es -o ./ ``` -See the [package source](https://github.com/lodash/lodash/tree/4.17.1-es) for more details. +See the [package source](https://github.com/lodash/lodash/tree/4.17.2-es) for more details. diff --git a/_basePickBy.js b/_basePickBy.js index 95e995405..f2610c599 100644 --- a/_basePickBy.js +++ b/_basePickBy.js @@ -1,5 +1,6 @@ import baseGet from './_baseGet.js'; import baseSet from './_baseSet.js'; +import castPath from './_castPath.js'; /** * The base implementation of `_.pickBy` without support for iteratee shorthands. @@ -20,7 +21,7 @@ function basePickBy(object, paths, predicate) { value = baseGet(object, path); if (predicate(value, path)) { - baseSet(result, path, value); + baseSet(result, castPath(path, object), value); } } return result; diff --git a/_basePullAt.js b/_basePullAt.js index 175e92070..9305613ed 100644 --- a/_basePullAt.js +++ b/_basePullAt.js @@ -1,8 +1,5 @@ -import castPath from './_castPath.js'; +import baseUnset from './_baseUnset.js'; import isIndex from './_isIndex.js'; -import last from './last.js'; -import parent from './_parent.js'; -import toKey from './_toKey.js'; /** Used for built-in method references. */ var arrayProto = Array.prototype; @@ -29,14 +26,8 @@ function basePullAt(array, indexes) { var previous = index; if (isIndex(index)) { splice.call(array, index, 1); - } - else { - var path = castPath(index, array), - object = parent(array, path); - - if (object != null) { - delete object[toKey(last(path))]; - } + } else { + baseUnset(array, index); } } } diff --git a/_baseUnset.js b/_baseUnset.js index 404b3c764..64b7b9cb9 100644 --- a/_baseUnset.js +++ b/_baseUnset.js @@ -3,12 +3,6 @@ import last from './last.js'; import parent from './_parent.js'; import toKey from './_toKey.js'; -/** Used for built-in method references. */ -var objectProto = Object.prototype; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - /** * The base implementation of `_.unset`. * @@ -20,8 +14,7 @@ var hasOwnProperty = objectProto.hasOwnProperty; function baseUnset(object, path) { path = castPath(path, object); object = parent(object, path); - var key = toKey(last(path)); - return !(object != null && hasOwnProperty.call(object, key)) || delete object[key]; + return object == null || delete object[toKey(last(path))]; } export default baseUnset; diff --git a/lodash.default.js b/lodash.default.js index f59f6b1f7..159824daf 100644 --- a/lodash.default.js +++ b/lodash.default.js @@ -45,7 +45,7 @@ import toInteger from './toInteger.js'; import lodash from './wrapperLodash.js'; /** Used as the semantic version number. */ -var VERSION = '4.17.1'; +var VERSION = '4.17.2'; /** Used to compose bitmasks for function metadata. */ var WRAP_BIND_KEY_FLAG = 2; diff --git a/omit.js b/omit.js index 4f01ca99b..f23a9ca4a 100644 --- a/omit.js +++ b/omit.js @@ -36,16 +36,16 @@ var omit = flatRest(function(object, paths) { if (object == null) { return result; } - var bitmask = CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG; + var isDeep = false; paths = arrayMap(paths, function(path) { path = castPath(path, object); - bitmask |= (path.length > 1 ? CLONE_DEEP_FLAG : 0); + isDeep || (isDeep = path.length > 1); return path; }); - copyObject(object, getAllKeysIn(object), result); - result = baseClone(result, bitmask); - + if (isDeep) { + result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG); + } var length = paths.length; while (length--) { baseUnset(result, paths[length]); diff --git a/package.json b/package.json index 5411a0c4a..7cdba41ab 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lodash-es", - "version": "4.17.1", + "version": "4.17.2", "description": "Lodash exported as ES modules.", "keywords": "es6, modules, stdlib, util", "homepage": "https://lodash.com/custom-builds", diff --git a/result.js b/result.js index 9b384e390..fe519c817 100644 --- a/result.js +++ b/result.js @@ -39,8 +39,8 @@ function result(object, path, defaultValue) { // Ensure the loop is entered when path is empty. if (!length) { - object = undefined; length = 1; + object = undefined; } while (++index < length) { var value = object == null ? undefined : object[toKey(path[index])]; diff --git a/spread.js b/spread.js index 0c973425e..cf221cfc9 100644 --- a/spread.js +++ b/spread.js @@ -51,15 +51,11 @@ function spread(func, start) { start = start === undefined ? 0 : nativeMax(toInteger(start), 0); return baseRest(function(args) { var array = args[start], - lastIndex = args.length - 1, otherArgs = castSlice(args, 0, start); if (array) { arrayPush(otherArgs, array); } - if (start != lastIndex) { - arrayPush(otherArgs, castSlice(args, start + 1)); - } return apply(func, this, otherArgs); }); }