diff --git a/README.md b/README.md index b9e56a5bb..965a5afd4 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# lodash-es v4.6.0 +# lodash-es v4.6.1 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.6.0-es) for more details. +See the [package source](https://github.com/lodash/lodash/tree/4.6.1-es) for more details. diff --git a/_baseClone.js b/_baseClone.js index 7a56fd1f2..deb2f1c65 100644 --- a/_baseClone.js +++ b/_baseClone.js @@ -66,13 +66,14 @@ cloneableTags[weakMapTag] = false; * @private * @param {*} value The value to clone. * @param {boolean} [isDeep] Specify a deep clone. + * @param {boolean} [isFull] Specify a clone including symbols. * @param {Function} [customizer] The function to customize cloning. * @param {string} [key] The key of `value`. * @param {Object} [object] The parent object of `value`. * @param {Object} [stack] Tracks traversed objects and their clone counterparts. * @returns {*} Returns the cloned value. */ -function baseClone(value, isDeep, customizer, key, object, stack) { +function baseClone(value, isDeep, isFull, customizer, key, object, stack) { var result; if (customizer) { result = object ? customizer(value, key, object, stack) : customizer(value); @@ -102,7 +103,8 @@ function baseClone(value, isDeep, customizer, key, object, stack) { } result = initCloneObject(isFunc ? {} : value); if (!isDeep) { - return copySymbols(value, baseAssign(result, value)); + result = baseAssign(result, value); + return isFull ? copySymbols(value, result) : result; } } else { if (!cloneableTags[tag]) { @@ -121,9 +123,9 @@ function baseClone(value, isDeep, customizer, key, object, stack) { // Recursively populate clone (susceptible to call stack limits). (isArr ? arrayEach : baseForOwn)(value, function(subValue, key) { - assignValue(result, key, baseClone(subValue, isDeep, customizer, key, value, stack)); + assignValue(result, key, baseClone(subValue, isDeep, isFull, customizer, key, value, stack)); }); - return isArr ? result : copySymbols(value, result); + return (isFull && !isArr) ? copySymbols(value, result) : result; } export default baseClone; diff --git a/assign.js b/assign.js index d4a4fd780..d56948675 100644 --- a/assign.js +++ b/assign.js @@ -11,8 +11,11 @@ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; +/** Built-in value references. */ +var propertyIsEnumerable = objectProto.propertyIsEnumerable; + /** Detect if properties shadowing those on `Object.prototype` are non-enumerable. */ -var nonEnumShadows = !({ 'valueOf': 1 }).propertyIsEnumerable('valueOf'); +var nonEnumShadows = !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf'); /** * Assigns own enumerable properties of source objects to the destination diff --git a/assignIn.js b/assignIn.js index 317187873..49824959b 100644 --- a/assignIn.js +++ b/assignIn.js @@ -5,8 +5,14 @@ import isArrayLike from './isArrayLike'; import isPrototype from './_isPrototype'; import keysIn from './keysIn'; +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Built-in value references. */ +var propertyIsEnumerable = objectProto.propertyIsEnumerable; + /** Detect if properties shadowing those on `Object.prototype` are non-enumerable. */ -var nonEnumShadows = !({ 'valueOf': 1 }).propertyIsEnumerable('valueOf'); +var nonEnumShadows = !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf'); /** * This method is like `_.assign` except that it iterates over own and diff --git a/clone.js b/clone.js index 92b2d33f0..e59661ace 100644 --- a/clone.js +++ b/clone.js @@ -25,7 +25,7 @@ import baseClone from './_baseClone'; * // => true */ function clone(value) { - return baseClone(value); + return baseClone(value, false, true); } export default clone; diff --git a/cloneDeep.js b/cloneDeep.js index 81c7febfa..bd289e5bb 100644 --- a/cloneDeep.js +++ b/cloneDeep.js @@ -17,7 +17,7 @@ import baseClone from './_baseClone'; * // => false */ function cloneDeep(value) { - return baseClone(value, true); + return baseClone(value, true, true); } export default cloneDeep; diff --git a/cloneDeepWith.js b/cloneDeepWith.js index 8219adaa0..4c7e84bcf 100644 --- a/cloneDeepWith.js +++ b/cloneDeepWith.js @@ -27,7 +27,7 @@ import baseClone from './_baseClone'; * // => 20 */ function cloneDeepWith(value, customizer) { - return baseClone(value, true, customizer); + return baseClone(value, true, true, customizer); } export default cloneDeepWith; diff --git a/cloneWith.js b/cloneWith.js index a7e2181b7..e269e282e 100644 --- a/cloneWith.js +++ b/cloneWith.js @@ -30,7 +30,7 @@ import baseClone from './_baseClone'; * // => 0 */ function cloneWith(value, customizer) { - return baseClone(value, false, customizer); + return baseClone(value, false, true, customizer); } export default cloneWith; diff --git a/lodash.default.js b/lodash.default.js index 3a74287f2..7a25a762a 100644 --- a/lodash.default.js +++ b/lodash.default.js @@ -1,6 +1,6 @@ /** * @license - * lodash 4.6.0 (Custom Build) + * lodash 4.6.1 (Custom Build) * Build: `lodash modularize exports="es" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -44,7 +44,7 @@ import toInteger from './toInteger'; import lodash from './wrapperLodash'; /** Used as the semantic version number. */ -var VERSION = '4.6.0'; +var VERSION = '4.6.1'; /** Used to compose bitmasks for wrapper metadata. */ var BIND_KEY_FLAG = 2; diff --git a/lodash.js b/lodash.js index 7cfb2fb00..50f861d1b 100644 --- a/lodash.js +++ b/lodash.js @@ -1,6 +1,6 @@ /** * @license - * lodash 4.6.0 (Custom Build) + * lodash 4.6.1 (Custom Build) * Build: `lodash modularize exports="es" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 diff --git a/package.json b/package.json index 441c14eb8..0d37da8f9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lodash-es", - "version": "4.6.0", + "version": "4.6.1", "description": "Lodash exported as ES modules.", "homepage": "https://lodash.com/custom-builds", "license": "MIT",