lodash.has
Advanced tools
Comparing version 4.5.1 to 4.5.2
113
index.js
@@ -24,3 +24,2 @@ /** | ||
genTag = '[object GeneratorFunction]', | ||
stringTag = '[object String]', | ||
symbolTag = '[object Symbol]'; | ||
@@ -36,3 +35,3 @@ | ||
* Used to match `RegExp` | ||
* [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). | ||
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). | ||
*/ | ||
@@ -60,15 +59,2 @@ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; | ||
/** | ||
* The base implementation of `_.property` without support for deep paths. | ||
* | ||
* @private | ||
* @param {string} key The key of the property to get. | ||
* @returns {Function} Returns the new accessor function. | ||
*/ | ||
function baseProperty(key) { | ||
return function(object) { | ||
return object == null ? undefined : object[key]; | ||
}; | ||
} | ||
/** | ||
* Gets the value at `key` of `object`. | ||
@@ -104,18 +90,5 @@ * | ||
/** | ||
* Creates a function that invokes `func` with its first argument transformed. | ||
* | ||
* @private | ||
* @param {Function} func The function to wrap. | ||
* @param {Function} transform The argument transform. | ||
* @returns {Function} Returns the new function. | ||
*/ | ||
function overArg(func, transform) { | ||
return function(arg) { | ||
return func(transform(arg)); | ||
}; | ||
} | ||
/** Used for built-in method references. */ | ||
var arrayProto = Array.prototype, | ||
funcProto = Function.prototype, | ||
objectProto = Object.prototype; | ||
@@ -133,3 +106,3 @@ | ||
/** Used to resolve the decompiled source of functions. */ | ||
var funcToString = Function.prototype.toString; | ||
var funcToString = funcProto.toString; | ||
@@ -141,3 +114,3 @@ /** Used to check objects for own properties. */ | ||
* Used to resolve the | ||
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) | ||
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) | ||
* of values. | ||
@@ -158,5 +131,2 @@ */ | ||
/* Built-in method references for those with the same name as other `lodash` methods. */ | ||
var nativeGetPrototype = Object.getPrototypeOf; | ||
/* Built-in method references that are verified to be native. */ | ||
@@ -478,3 +448,3 @@ var Map = getNative(root, 'Map'), | ||
* @private | ||
* @param {Array} array The array to search. | ||
* @param {Array} array The array to inspect. | ||
* @param {*} key The key to search for. | ||
@@ -502,8 +472,3 @@ * @returns {number} Returns the index of the matched value, else `-1`. | ||
function baseHas(object, key) { | ||
// Avoid a bug in IE 10-11 where objects with a [[Prototype]] of `null`, | ||
// that are composed entirely of index properties, return `false` for | ||
// `hasOwnProperty` checks of them. | ||
return object != null && | ||
(hasOwnProperty.call(object, key) || | ||
(typeof object == 'object' && key in object && getPrototype(object) === null)); | ||
return object != null && hasOwnProperty.call(object, key); | ||
} | ||
@@ -559,15 +524,2 @@ | ||
/** | ||
* Gets the "length" property value of `object`. | ||
* | ||
* **Note:** This function is used to avoid a | ||
* [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects | ||
* Safari on at least iOS 8.1-8.3 ARM64. | ||
* | ||
* @private | ||
* @param {Object} object The object to query. | ||
* @returns {*} Returns the "length" value. | ||
*/ | ||
var getLength = baseProperty('length'); | ||
/** | ||
* Gets the data for `map`. | ||
@@ -601,11 +553,2 @@ * | ||
/** | ||
* Gets the `[[Prototype]]` of `value`. | ||
* | ||
* @private | ||
* @param {*} value The value to query. | ||
* @returns {null|Object} Returns the `[[Prototype]]`. | ||
*/ | ||
var getPrototype = overArg(nativeGetPrototype, Object); | ||
/** | ||
* Checks if `path` exists on `object`. | ||
@@ -638,3 +581,3 @@ * | ||
return !!length && isLength(length) && isIndex(key, length) && | ||
(isArray(object) || isString(object) || isArguments(object)); | ||
(isArray(object) || isArguments(object)); | ||
} | ||
@@ -767,3 +710,3 @@ | ||
* constructor with one whose instances implement the | ||
* [`Map`](http://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-map-prototype-object) | ||
* [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object) | ||
* method interface of `delete`, `get`, `has`, and `set`. | ||
@@ -827,3 +770,3 @@ * | ||
* Performs a | ||
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) | ||
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) | ||
* comparison between two values to determine if they are equivalent. | ||
@@ -881,3 +824,3 @@ * | ||
function isArguments(value) { | ||
// Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode. | ||
// Safari 8.1 makes `arguments.callee` enumerable in strict mode. | ||
return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && | ||
@@ -938,3 +881,3 @@ (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); | ||
function isArrayLike(value) { | ||
return value != null && isLength(getLength(value)) && !isFunction(value); | ||
return value != null && isLength(value.length) && !isFunction(value); | ||
} | ||
@@ -990,4 +933,3 @@ | ||
// The use of `Object#toString` avoids issues with the `typeof` operator | ||
// in Safari 8 which returns 'object' for typed array and weak map constructors, | ||
// and PhantomJS 1.9 which returns 'function' for `NodeList` instances. | ||
// in Safari 8-9 which returns 'object' for typed array and other constructors. | ||
var tag = isObject(value) ? objectToString.call(value) : ''; | ||
@@ -1000,4 +942,4 @@ return tag == funcTag || tag == genTag; | ||
* | ||
* **Note:** This function is loosely based on | ||
* [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). | ||
* **Note:** This method is loosely based on | ||
* [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). | ||
* | ||
@@ -1009,4 +951,3 @@ * @static | ||
* @param {*} value The value to check. | ||
* @returns {boolean} Returns `true` if `value` is a valid length, | ||
* else `false`. | ||
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`. | ||
* @example | ||
@@ -1033,3 +974,3 @@ * | ||
* Checks if `value` is the | ||
* [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) | ||
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) | ||
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) | ||
@@ -1091,24 +1032,2 @@ * | ||
/** | ||
* Checks if `value` is classified as a `String` primitive or object. | ||
* | ||
* @static | ||
* @since 0.1.0 | ||
* @memberOf _ | ||
* @category Lang | ||
* @param {*} value The value to check. | ||
* @returns {boolean} Returns `true` if `value` is a string, else `false`. | ||
* @example | ||
* | ||
* _.isString('abc'); | ||
* // => true | ||
* | ||
* _.isString(1); | ||
* // => false | ||
*/ | ||
function isString(value) { | ||
return typeof value == 'string' || | ||
(!isArray(value) && isObjectLike(value) && objectToString.call(value) == stringTag); | ||
} | ||
/** | ||
* Checks if `value` is classified as a `Symbol` primitive or object. | ||
@@ -1115,0 +1034,0 @@ * |
{ | ||
"name": "lodash.has", | ||
"version": "4.5.1", | ||
"version": "4.5.2", | ||
"description": "The lodash method `_.has` exported as a module.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://lodash.com/", |
@@ -1,2 +0,2 @@ | ||
# lodash.has v4.5.1 | ||
# lodash.has v4.5.2 | ||
@@ -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.5.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.5.2-npm-packages/lodash.has) 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
30370
1004