Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lodash.invoke

Package Overview
Dependencies
Maintainers
3
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lodash.invoke - npm Package Compare versions

Comparing version 4.2.1 to 4.3.0

114

index.js
/**
* lodash 4.2.1 (Custom Build) <https://lodash.com/>
* lodash 4.3.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 baseSlice = require('lodash._baseslice'),
rest = require('lodash.rest'),
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;
/**

@@ -42,3 +41,12 @@ * A faster alternative to `Function#apply`, this function invokes `func`

/** 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 a path array if it's not one.

@@ -63,3 +71,3 @@ *

function baseGet(object, path) {
path = isKey(path, object) ? [path + ''] : baseCastPath(path);
path = isKey(path, object) ? [path] : baseCastPath(path);

@@ -104,7 +112,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)));

@@ -122,21 +131,6 @@ }

function parent(object, path) {
return path.length == 1 ? object : get(object, baseSlice(path, 0, -1));
return path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));
}
/**
* 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;
}
/**
* Gets the last element of `array`.

@@ -146,2 +140,3 @@ *

* @memberOf _
* @since 0.1.0
* @category Array

@@ -165,6 +160,8 @@ * @param {Array} array The array to query.

* @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

@@ -187,31 +184,53 @@ *

/**
* Gets the value at `path` of `object`. If the resolved value is
* `undefined` the `defaultValue` is used in its place.
* 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 _
* @category Object
* @param {Object} object The object to query.
* @param {Array|string} path The path of the property to get.
* @param {*} [defaultValue] The value returned if the resolved value is `undefined`.
* @returns {*} Returns the resolved value.
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
* @example
*
* var object = { 'a': [{ 'b': { 'c': 3 } }] };
* _.isObjectLike({});
* // => true
*
* _.get(object, 'a[0].b.c');
* // => 3
* _.isObjectLike([1, 2, 3]);
* // => true
*
* _.get(object, ['a', '0', 'b', 'c']);
* // => 3
* _.isObjectLike(_.noop);
* // => false
*
* _.get(object, 'a.b.c', 'default');
* // => 'default'
* _.isObjectLike(null);
* // => false
*/
function get(object, path, defaultValue) {
var result = object == null ? undefined : baseGet(object, path);
return result === undefined ? defaultValue : result;
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);
}
/**
* Invokes the method at `path` of `object`.

@@ -221,2 +240,3 @@ *

* @memberOf _
* @since 4.0.0
* @category Object

@@ -223,0 +243,0 @@ * @param {Object} object The object to query.

{
"name": "lodash.invoke",
"version": "4.2.1",
"version": "4.3.0",
"description": "The lodash method `_.invoke` exported as a module.",

@@ -19,5 +19,5 @@ "homepage": "https://lodash.com/",

"lodash._baseslice": "~4.0.0",
"lodash.rest": "^4.0.0",
"lodash.tostring": "^4.0.0"
"lodash._stringtopath": "~4.7.0",
"lodash.rest": "^4.0.0"
}
}

@@ -1,2 +0,2 @@

# lodash.invoke v4.2.1
# lodash.invoke v4.3.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.2.1-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.3.0-npm-packages/lodash.invoke) for more details.

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc