lodash.invoke
Advanced tools
Comparing version 4.3.0 to 4.4.0
66
index.js
/** | ||
* lodash 4.3.0 (Custom Build) <https://lodash.com/> | ||
* lodash (Custom Build) <https://lodash.com/> | ||
* Build: `lodash modularize exports="npm" -o ./` | ||
@@ -13,2 +13,5 @@ * Copyright jQuery Foundation and other contributors <https://jquery.org/> | ||
/** Used as references for various `Number` constants. */ | ||
var INFINITY = 1 / 0; | ||
/** `Object#toString` result references. */ | ||
@@ -28,3 +31,3 @@ var symbolTag = '[object Symbol]'; | ||
* @param {*} thisArg The `this` binding of `func`. | ||
* @param {...*} args The arguments to invoke `func` with. | ||
* @param {Array} args The arguments to invoke `func` with. | ||
* @returns {*} Returns the result of `func`. | ||
@@ -47,3 +50,4 @@ */ | ||
/** | ||
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) | ||
* Used to resolve the | ||
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) | ||
* of values. | ||
@@ -54,13 +58,2 @@ */ | ||
/** | ||
* Casts `value` to a path array if it's not one. | ||
* | ||
* @private | ||
* @param {*} value The value to inspect. | ||
* @returns {Array} Returns the cast property path array. | ||
*/ | ||
function baseCastPath(value) { | ||
return isArray(value) ? value : stringToPath(value); | ||
} | ||
/** | ||
* The base implementation of `_.get` without support for default values. | ||
@@ -74,3 +67,3 @@ * | ||
function baseGet(object, path) { | ||
path = isKey(path, object) ? [path] : baseCastPath(path); | ||
path = isKey(path, object) ? [path] : castPath(path); | ||
@@ -81,3 +74,3 @@ var index = 0, | ||
while (object != null && index < length) { | ||
object = object[path[index++]]; | ||
object = object[toKey(path[index++])]; | ||
} | ||
@@ -99,7 +92,7 @@ return (index && index == length) ? object : undefined; | ||
if (!isKey(path, object)) { | ||
path = baseCastPath(path); | ||
path = castPath(path); | ||
object = parent(object, path); | ||
path = last(path); | ||
} | ||
var func = object == null ? object : object[path]; | ||
var func = object == null ? object : object[toKey(path)]; | ||
return func == null ? undefined : apply(func, object, args); | ||
@@ -109,2 +102,13 @@ } | ||
/** | ||
* Casts `value` to a path array if it's not one. | ||
* | ||
* @private | ||
* @param {*} value The value to inspect. | ||
* @returns {Array} Returns the cast property path array. | ||
*/ | ||
function castPath(value) { | ||
return isArray(value) ? value : stringToPath(value); | ||
} | ||
/** | ||
* Checks if `value` is a property name and not a property path. | ||
@@ -118,9 +122,12 @@ * | ||
function isKey(value, object) { | ||
if (isArray(value)) { | ||
return false; | ||
} | ||
var type = typeof value; | ||
if (type == 'number' || type == 'symbol') { | ||
if (type == 'number' || type == 'symbol' || type == 'boolean' || | ||
value == null || isSymbol(value)) { | ||
return true; | ||
} | ||
return !isArray(value) && | ||
(isSymbol(value) || reIsPlainProp.test(value) || !reIsDeepProp.test(value) || | ||
(object != null && value in Object(object))); | ||
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || | ||
(object != null && value in Object(object)); | ||
} | ||
@@ -141,2 +148,17 @@ | ||
/** | ||
* Converts `value` to a string key if it's not a string or symbol. | ||
* | ||
* @private | ||
* @param {*} value The value to inspect. | ||
* @returns {string|symbol} Returns the key. | ||
*/ | ||
function toKey(value) { | ||
if (typeof value == 'string' || isSymbol(value)) { | ||
return value; | ||
} | ||
var result = (value + ''); | ||
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; | ||
} | ||
/** | ||
* Gets the last element of `array`. | ||
@@ -143,0 +165,0 @@ * |
{ | ||
"name": "lodash.invoke", | ||
"version": "4.3.0", | ||
"version": "4.4.0", | ||
"description": "The lodash method `_.invoke` exported as a module.", | ||
@@ -19,5 +19,5 @@ "homepage": "https://lodash.com/", | ||
"lodash._baseslice": "~4.0.0", | ||
"lodash._stringtopath": "~4.7.0", | ||
"lodash._stringtopath": "~4.8.0", | ||
"lodash.rest": "^4.0.0" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# lodash.invoke v4.3.0 | ||
# lodash.invoke v4.4.0 | ||
@@ -18,2 +18,2 @@ The [lodash](https://lodash.com/) method `_.invoke` exported as a [Node.js](https://nodejs.org/) module. | ||
See the [documentation](https://lodash.com/docs#invoke) or [package source](https://github.com/lodash/lodash/blob/4.3.0-npm-packages/lodash.invoke) for more details. | ||
See the [documentation](https://lodash.com/docs#invoke) or [package source](https://github.com/lodash/lodash/blob/4.4.0-npm-packages/lodash.invoke) for more details. |
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
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
10362
250
+ Addedlodash._basetostring@4.12.0(transitive)
+ Addedlodash._stringtopath@4.8.0(transitive)
- Removedlodash._stringtopath@4.7.1(transitive)
Updatedlodash._stringtopath@~4.8.0