lodash.update
Advanced tools
Comparing version 4.6.1 to 4.7.0
107
index.js
/** | ||
* lodash 4.6.1 (Custom Build) <https://lodash.com/> | ||
* lodash 4.7.0 (Custom Build) <https://lodash.com/> | ||
* Build: `lodash modularize exports="npm" -o ./` | ||
* Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/> | ||
* Copyright jQuery Foundation and other contributors <https://jquery.org/> | ||
* Released under MIT license <https://lodash.com/license> | ||
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> | ||
* Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors | ||
* Available under MIT license <https://lodash.com/license> | ||
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors | ||
*/ | ||
var baseSet = require('lodash._baseset'), | ||
toString = require('lodash.tostring'); | ||
stringToPath = require('lodash._stringtopath'); | ||
/** `Object#toString` result references. */ | ||
var symbolTag = '[object Symbol]'; | ||
/** Used to match property names within property paths. */ | ||
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, | ||
reIsPlainProp = /^\w*$/, | ||
rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; | ||
reIsPlainProp = /^\w*$/; | ||
/** Used to match backslashes in property paths. */ | ||
var reEscapeChar = /\\(\\)?/g; | ||
/** Used for built-in method references. */ | ||
var objectProto = Object.prototype; | ||
/** | ||
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) | ||
* of values. | ||
*/ | ||
var objectToString = objectProto.toString; | ||
/** | ||
* Casts `value` to `identity` if it's not a function. | ||
@@ -25,3 +33,3 @@ * | ||
* @param {*} value The value to inspect. | ||
* @returns {Array} Returns the array-like object. | ||
* @returns {Function} Returns cast function. | ||
*/ | ||
@@ -52,3 +60,3 @@ function baseCastFunction(value) { | ||
function baseGet(object, path) { | ||
path = isKey(path, object) ? [path + ''] : baseCastPath(path); | ||
path = isKey(path, object) ? [path] : baseCastPath(path); | ||
@@ -87,7 +95,8 @@ var index = 0, | ||
function isKey(value, object) { | ||
if (typeof value == 'number') { | ||
var type = typeof value; | ||
if (type == 'number' || type == 'symbol') { | ||
return true; | ||
} | ||
return !isArray(value) && | ||
(reIsPlainProp.test(value) || !reIsDeepProp.test(value) || | ||
(isSymbol(value) || reIsPlainProp.test(value) || !reIsDeepProp.test(value) || | ||
(object != null && value in Object(object))); | ||
@@ -97,17 +106,2 @@ } | ||
/** | ||
* Converts `string` to a property path array. | ||
* | ||
* @private | ||
* @param {string} string The string to convert. | ||
* @returns {Array} Returns the property path array. | ||
*/ | ||
function stringToPath(string) { | ||
var result = []; | ||
toString(string).replace(rePropName, function(match, number, quote, string) { | ||
result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); | ||
}); | ||
return result; | ||
} | ||
/** | ||
* Checks if `value` is classified as an `Array` object. | ||
@@ -117,6 +111,8 @@ * | ||
* @memberOf _ | ||
* @since 0.1.0 | ||
* @type {Function} | ||
* @category Lang | ||
* @param {*} value The value to check. | ||
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. | ||
* @returns {boolean} Returns `true` if `value` is correctly classified, | ||
* else `false`. | ||
* @example | ||
@@ -139,2 +135,53 @@ * | ||
/** | ||
* Checks if `value` is object-like. A value is object-like if it's not `null` | ||
* and has a `typeof` result of "object". | ||
* | ||
* @static | ||
* @memberOf _ | ||
* @since 4.0.0 | ||
* @category Lang | ||
* @param {*} value The value to check. | ||
* @returns {boolean} Returns `true` if `value` is object-like, else `false`. | ||
* @example | ||
* | ||
* _.isObjectLike({}); | ||
* // => true | ||
* | ||
* _.isObjectLike([1, 2, 3]); | ||
* // => true | ||
* | ||
* _.isObjectLike(_.noop); | ||
* // => false | ||
* | ||
* _.isObjectLike(null); | ||
* // => false | ||
*/ | ||
function isObjectLike(value) { | ||
return !!value && typeof value == 'object'; | ||
} | ||
/** | ||
* Checks if `value` is classified as a `Symbol` primitive or object. | ||
* | ||
* @static | ||
* @memberOf _ | ||
* @since 4.0.0 | ||
* @category Lang | ||
* @param {*} value The value to check. | ||
* @returns {boolean} Returns `true` if `value` is correctly classified, | ||
* else `false`. | ||
* @example | ||
* | ||
* _.isSymbol(Symbol.iterator); | ||
* // => true | ||
* | ||
* _.isSymbol('abc'); | ||
* // => false | ||
*/ | ||
function isSymbol(value) { | ||
return typeof value == 'symbol' || | ||
(isObjectLike(value) && objectToString.call(value) == symbolTag); | ||
} | ||
/** | ||
* This method is like `_.set` except that accepts `updater` to produce the | ||
@@ -148,2 +195,3 @@ * value to set. Use `_.updateWith` to customize `path` creation. The `updater` | ||
* @memberOf _ | ||
* @since 4.6.0 | ||
* @category Object | ||
@@ -174,2 +222,3 @@ * @param {Object} object The object to modify. | ||
* @static | ||
* @since 0.1.0 | ||
* @memberOf _ | ||
@@ -176,0 +225,0 @@ * @category Util |
{ | ||
"name": "lodash.update", | ||
"version": "4.6.1", | ||
"version": "4.7.0", | ||
"description": "The lodash method `_.update` exported as a module.", | ||
@@ -18,5 +18,5 @@ "homepage": "https://lodash.com/", | ||
"dependencies": { | ||
"lodash._baseset": "~4.1.0", | ||
"lodash.tostring": "^4.0.0" | ||
"lodash._baseset": "~4.2.0", | ||
"lodash._stringtopath": "~4.7.0" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# lodash.update v4.6.1 | ||
# lodash.update v4.7.0 | ||
@@ -18,2 +18,2 @@ The [lodash](https://lodash.com/) method `_.update` exported as a [Node.js](https://nodejs.org/) module. | ||
See the [documentation](https://lodash.com/docs#update) or [package source](https://github.com/lodash/lodash/blob/4.6.1-npm-packages/lodash.update) for more details. | ||
See the [documentation](https://lodash.com/docs#update) or [package source](https://github.com/lodash/lodash/blob/4.7.0-npm-packages/lodash.update) for more details. |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9261
214
1
+ Addedlodash._stringtopath@~4.7.0
+ Addedlodash._baseset@4.2.1(transitive)
+ Addedlodash._stringtopath@4.7.1(transitive)
- Removedlodash.tostring@^4.0.0
- Removedlodash._baseset@4.1.3(transitive)
- Removedlodash.tostring@4.1.4(transitive)
Updatedlodash._baseset@~4.2.0