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

lodash.has

Package Overview
Dependencies
Maintainers
3
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lodash.has - npm Package Compare versions

Comparing version 4.1.1 to 4.2.0

84

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

@@ -10,3 +10,2 @@ * Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>

var baseSlice = require('lodash._baseslice'),
get = require('lodash.get'),
toString = require('lodash.tostring');

@@ -65,2 +64,33 @@

/**
* 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.
*
* @private
* @param {Object} object The object to query.
* @param {Array|string} path The path of the property to get.
* @returns {*} Returns the resolved value.
*/
function baseGet(object, path) {
path = isKey(path, object) ? [path + ''] : baseCastPath(path);
var index = 0,
length = path.length;
while (object != null && index < length) {
object = object[path[index++]];
}
return (index && index == length) ? object : undefined;
}
/**
* The base implementation of `_.has` without support for deep paths.

@@ -95,14 +125,2 @@ *

/**
* The base implementation of `_.toPath` which only converts `value` to a
* path if it's not one.
*
* @private
* @param {*} value The value to process.
* @returns {Array} Returns the property path array.
*/
function baseToPath(value) {
return isArray(value) ? value : stringToPath(value);
}
/**
* Gets the "length" property value of `object`.

@@ -134,3 +152,3 @@ *

if (!result && !isKey(path)) {
path = baseToPath(path);
path = baseCastPath(path);
object = parent(object, path);

@@ -238,3 +256,3 @@ if (object != null) {

* @memberOf _
* @type Function
* @type {Function}
* @category Lang

@@ -266,3 +284,2 @@ * @param {*} value The value to check.

* @memberOf _
* @type Function
* @category Lang

@@ -296,3 +313,2 @@ * @param {*} value The value to check.

* @memberOf _
* @type Function
* @category Lang

@@ -368,3 +384,4 @@ * @param {*} value The value to check.

function isLength(value) {
return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
return typeof value == 'number' &&
value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
}

@@ -449,2 +466,31 @@

/**
* Gets the value at `path` of `object`. If the resolved value is
* `undefined` the `defaultValue` is used in its place.
*
* @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.
* @example
*
* var object = { 'a': [{ 'b': { 'c': 3 } }] };
*
* _.get(object, 'a[0].b.c');
* // => 3
*
* _.get(object, ['a', '0', 'b', 'c']);
* // => 3
*
* _.get(object, 'a.b.c', 'default');
* // => 'default'
*/
function get(object, path, defaultValue) {
var result = object == null ? undefined : baseGet(object, path);
return result === undefined ? defaultValue : result;
}
/**
* Checks if `path` is a direct property of `object`.

@@ -451,0 +497,0 @@ *

{
"name": "lodash.has",
"version": "4.1.1",
"version": "4.2.0",
"description": "The lodash method `_.has` exported as a module.",

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

"lodash._baseslice": "^4.0.0",
"lodash.get": "^4.0.0",
"lodash.tostring": "^4.0.0"
}
}

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

# lodash.has v4.1.1
# lodash.has v4.2.0

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

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