Socket
Socket
Sign inDemoInstall

lodash.result

Package Overview
Dependencies
Maintainers
3
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lodash.result - npm Package Compare versions

Comparing version 4.3.0 to 4.4.0

45

index.js
/**
* lodash 4.3.0 (Custom Build) <https://lodash.com/>
* lodash (Custom Build) <https://lodash.com/>
* Build: `lodash modularize exports="npm" -o ./`

@@ -11,2 +11,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. */

@@ -25,3 +28,4 @@ var funcTag = '[object Function]',

/**
* 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.

@@ -38,3 +42,3 @@ */

*/
function baseCastPath(value) {
function castPath(value) {
return isArray(value) ? value : stringToPath(value);

@@ -52,12 +56,30 @@ }

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));
}
/**
* 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;
}
/**
* Checks if `value` is classified as an `Array` object.

@@ -116,4 +138,5 @@ *

/**
* Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
* (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
* Checks if `value` is the
* [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types)
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
*

@@ -226,3 +249,3 @@ * @static

function result(object, path, defaultValue) {
path = isKey(path, object) ? [path] : baseCastPath(path);
path = isKey(path, object) ? [path] : castPath(path);

@@ -238,3 +261,3 @@ var index = -1,

while (++index < length) {
var value = object == null ? undefined : object[path[index]];
var value = object == null ? undefined : object[toKey(path[index])];
if (value === undefined) {

@@ -241,0 +264,0 @@ index = length;

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

@@ -18,4 +18,4 @@ "homepage": "https://lodash.com/",

"dependencies": {
"lodash._stringtopath": "~4.7.0"
"lodash._stringtopath": "~4.8.0"
}
}

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

# lodash.result v4.3.0
# lodash.result v4.4.0

@@ -18,2 +18,2 @@ The [lodash](https://lodash.com/) method `_.result` exported as a [Node.js](https://nodejs.org/) module.

See the [documentation](https://lodash.com/docs#result) or [package source](https://github.com/lodash/lodash/blob/4.3.0-npm-packages/lodash.result) for more details.
See the [documentation](https://lodash.com/docs#result) or [package source](https://github.com/lodash/lodash/blob/4.4.0-npm-packages/lodash.result) for more details.
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