mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 06:27:49 +00:00
Bump to v4.15.0.
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
# lodash v4.14.0
|
# lodash v4.15.0
|
||||||
|
|
||||||
The [lodash](https://lodash.com/) library exported as [npm packages](https://www.npmjs.com/browse/keyword/lodash-modularized) per method.
|
The [lodash](https://lodash.com/) library exported as [npm packages](https://www.npmjs.com/browse/keyword/lodash-modularized) per method.
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# lodash.conformsto v4.14.0
|
# lodash.conformsto v4.15.0
|
||||||
|
|
||||||
The [lodash](https://lodash.com/) method `_.conformsTo` exported as a [Node.js](https://nodejs.org/) module.
|
The [lodash](https://lodash.com/) method `_.conformsTo` exported as a [Node.js](https://nodejs.org/) module.
|
||||||
|
|
||||||
@@ -15,4 +15,4 @@ In Node.js:
|
|||||||
var conformsTo = require('lodash.conformsto');
|
var conformsTo = require('lodash.conformsto');
|
||||||
```
|
```
|
||||||
|
|
||||||
See the [documentation](https://lodash.com/docs#conformsTo) or [package source](https://github.com/lodash/lodash/blob/4.14.0-npm-packages/lodash.conformsto) for more details.
|
See the [documentation](https://lodash.com/docs#conformsTo) or [package source](https://github.com/lodash/lodash/blob/4.15.0-npm-packages/lodash.conformsto) for more details.
|
||||||
|
|||||||
@@ -13,25 +13,11 @@ var MAX_SAFE_INTEGER = 9007199254740991;
|
|||||||
/** `Object#toString` result references. */
|
/** `Object#toString` result references. */
|
||||||
var argsTag = '[object Arguments]',
|
var argsTag = '[object Arguments]',
|
||||||
funcTag = '[object Function]',
|
funcTag = '[object Function]',
|
||||||
genTag = '[object GeneratorFunction]',
|
genTag = '[object GeneratorFunction]';
|
||||||
stringTag = '[object String]';
|
|
||||||
|
|
||||||
/** Used to detect unsigned integer values. */
|
/** Used to detect unsigned integer values. */
|
||||||
var reIsUint = /^(?:0|[1-9]\d*)$/;
|
var reIsUint = /^(?:0|[1-9]\d*)$/;
|
||||||
|
|
||||||
/**
|
|
||||||
* 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];
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base implementation of `_.times` without support for iteratee shorthands
|
* The base implementation of `_.times` without support for iteratee shorthands
|
||||||
* or max array length checks.
|
* or max array length checks.
|
||||||
@@ -52,7 +38,7 @@ function baseTimes(n, iteratee) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a function that invokes `func` with its first argument transformed.
|
* Creates a unary function that invokes `func` with its argument transformed.
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {Function} func The function to wrap.
|
* @param {Function} func The function to wrap.
|
||||||
@@ -73,7 +59,7 @@ var hasOwnProperty = objectProto.hasOwnProperty;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to resolve the
|
* 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.
|
* of values.
|
||||||
*/
|
*/
|
||||||
var objectToString = objectProto.toString;
|
var objectToString = objectProto.toString;
|
||||||
@@ -82,8 +68,34 @@ var objectToString = objectProto.toString;
|
|||||||
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
|
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
|
||||||
|
|
||||||
/* Built-in method references for those with the same name as other `lodash` methods. */
|
/* Built-in method references for those with the same name as other `lodash` methods. */
|
||||||
var nativeGetPrototype = Object.getPrototypeOf,
|
var nativeKeys = overArg(Object.keys, Object);
|
||||||
nativeKeys = Object.keys;
|
|
||||||
|
/**
|
||||||
|
* Creates an array of the enumerable property names of the array-like `value`.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {*} value The value to query.
|
||||||
|
* @param {boolean} inherited Specify returning inherited property names.
|
||||||
|
* @returns {Array} Returns the array of property names.
|
||||||
|
*/
|
||||||
|
function arrayLikeKeys(value, inherited) {
|
||||||
|
// Safari 8.1 makes `arguments.callee` enumerable in strict mode.
|
||||||
|
// Safari 9 makes `arguments.length` enumerable in strict mode.
|
||||||
|
var result = (isArray(value) || isArguments(value))
|
||||||
|
? baseTimes(value.length, String)
|
||||||
|
: [];
|
||||||
|
|
||||||
|
var length = result.length,
|
||||||
|
skipIndexes = !!length;
|
||||||
|
|
||||||
|
for (var key in value) {
|
||||||
|
if ((inherited || hasOwnProperty.call(value, key)) &&
|
||||||
|
!(skipIndexes && (key == 'length' || isIndex(key, length)))) {
|
||||||
|
result.push(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base implementation of `_.conformsTo` which accepts `props` to check.
|
* The base implementation of `_.conformsTo` which accepts `props` to check.
|
||||||
@@ -98,14 +110,13 @@ function baseConformsTo(object, source, props) {
|
|||||||
if (object == null) {
|
if (object == null) {
|
||||||
return !length;
|
return !length;
|
||||||
}
|
}
|
||||||
var index = length;
|
object = Object(object);
|
||||||
while (index--) {
|
while (length--) {
|
||||||
var key = props[index],
|
var key = props[length],
|
||||||
predicate = source[key],
|
predicate = source[key],
|
||||||
value = object[key];
|
value = object[key];
|
||||||
|
|
||||||
if ((value === undefined &&
|
if ((value === undefined && !(key in object)) || !predicate(value)) {
|
||||||
!(key in Object(object))) || !predicate(value)) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -113,69 +124,23 @@ function baseConformsTo(object, source, props) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base implementation of `_.has` without support for deep paths.
|
* The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Object} [object] The object to query.
|
|
||||||
* @param {Array|string} key The key to check.
|
|
||||||
* @returns {boolean} Returns `true` if `key` exists, else `false`.
|
|
||||||
*/
|
|
||||||
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));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The base implementation of `_.keys` which doesn't skip the constructor
|
|
||||||
* property of prototypes or treat sparse arrays as dense.
|
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {Object} object The object to query.
|
* @param {Object} object The object to query.
|
||||||
* @returns {Array} Returns the array of property names.
|
* @returns {Array} Returns the array of property names.
|
||||||
*/
|
*/
|
||||||
var baseKeys = overArg(nativeKeys, Object);
|
function baseKeys(object) {
|
||||||
|
if (!isPrototype(object)) {
|
||||||
/**
|
return nativeKeys(object);
|
||||||
* 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 `[[Prototype]]` of `value`.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {*} value The value to query.
|
|
||||||
* @returns {null|Object} Returns the `[[Prototype]]`.
|
|
||||||
*/
|
|
||||||
var getPrototype = overArg(nativeGetPrototype, Object);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates an array of index keys for `object` values of arrays,
|
|
||||||
* `arguments` objects, and strings, otherwise `null` is returned.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Object} object The object to query.
|
|
||||||
* @returns {Array|null} Returns index keys, else `null`.
|
|
||||||
*/
|
|
||||||
function indexKeys(object) {
|
|
||||||
var length = object ? object.length : undefined;
|
|
||||||
if (isLength(length) &&
|
|
||||||
(isArray(object) || isString(object) || isArguments(object))) {
|
|
||||||
return baseTimes(length, String);
|
|
||||||
}
|
}
|
||||||
return null;
|
var result = [];
|
||||||
|
for (var key in Object(object)) {
|
||||||
|
if (hasOwnProperty.call(object, key) && key != 'constructor') {
|
||||||
|
result.push(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -254,7 +219,7 @@ function conformsTo(object, source) {
|
|||||||
* // => false
|
* // => false
|
||||||
*/
|
*/
|
||||||
function isArguments(value) {
|
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') &&
|
return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
|
||||||
(!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
|
(!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
|
||||||
}
|
}
|
||||||
@@ -310,7 +275,7 @@ var isArray = Array.isArray;
|
|||||||
* // => false
|
* // => false
|
||||||
*/
|
*/
|
||||||
function isArrayLike(value) {
|
function isArrayLike(value) {
|
||||||
return value != null && isLength(getLength(value)) && !isFunction(value);
|
return value != null && isLength(value.length) && !isFunction(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -361,8 +326,7 @@ function isArrayLikeObject(value) {
|
|||||||
*/
|
*/
|
||||||
function isFunction(value) {
|
function isFunction(value) {
|
||||||
// The use of `Object#toString` avoids issues with the `typeof` operator
|
// The use of `Object#toString` avoids issues with the `typeof` operator
|
||||||
// in Safari 8 which returns 'object' for typed array and weak map constructors,
|
// in Safari 8-9 which returns 'object' for typed array and other constructors.
|
||||||
// and PhantomJS 1.9 which returns 'function' for `NodeList` instances.
|
|
||||||
var tag = isObject(value) ? objectToString.call(value) : '';
|
var tag = isObject(value) ? objectToString.call(value) : '';
|
||||||
return tag == funcTag || tag == genTag;
|
return tag == funcTag || tag == genTag;
|
||||||
}
|
}
|
||||||
@@ -370,16 +334,15 @@ function isFunction(value) {
|
|||||||
/**
|
/**
|
||||||
* Checks if `value` is a valid array-like length.
|
* Checks if `value` is a valid array-like length.
|
||||||
*
|
*
|
||||||
* **Note:** This function is loosely based on
|
* **Note:** This method is loosely based on
|
||||||
* [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
|
* [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
|
||||||
*
|
*
|
||||||
* @static
|
* @static
|
||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @since 4.0.0
|
* @since 4.0.0
|
||||||
* @category Lang
|
* @category Lang
|
||||||
* @param {*} value The value to check.
|
* @param {*} value The value to check.
|
||||||
* @returns {boolean} Returns `true` if `value` is a valid length,
|
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
|
||||||
* else `false`.
|
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* _.isLength(3);
|
* _.isLength(3);
|
||||||
@@ -401,7 +364,7 @@ function isLength(value) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if `value` is the
|
* 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('')`)
|
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
||||||
*
|
*
|
||||||
* @static
|
* @static
|
||||||
@@ -457,33 +420,11 @@ function isObjectLike(value) {
|
|||||||
return !!value && typeof value == 'object';
|
return !!value && typeof value == 'object';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an array of the own enumerable property names of `object`.
|
* Creates an array of the own enumerable property names of `object`.
|
||||||
*
|
*
|
||||||
* **Note:** Non-object values are coerced to objects. See the
|
* **Note:** Non-object values are coerced to objects. See the
|
||||||
* [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys)
|
* [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
|
||||||
* for more details.
|
* for more details.
|
||||||
*
|
*
|
||||||
* @static
|
* @static
|
||||||
@@ -508,23 +449,7 @@ function isString(value) {
|
|||||||
* // => ['0', '1']
|
* // => ['0', '1']
|
||||||
*/
|
*/
|
||||||
function keys(object) {
|
function keys(object) {
|
||||||
var isProto = isPrototype(object);
|
return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
|
||||||
if (!(isProto || isArrayLike(object))) {
|
|
||||||
return baseKeys(object);
|
|
||||||
}
|
|
||||||
var indexes = indexKeys(object),
|
|
||||||
skipIndexes = !!indexes,
|
|
||||||
result = indexes || [],
|
|
||||||
length = result.length;
|
|
||||||
|
|
||||||
for (var key in object) {
|
|
||||||
if (baseHas(object, key) &&
|
|
||||||
!(skipIndexes && (key == 'length' || isIndex(key, length))) &&
|
|
||||||
!(isProto && key == 'constructor')) {
|
|
||||||
result.push(key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = conformsTo;
|
module.exports = conformsTo;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "lodash.conformsto",
|
"name": "lodash.conformsto",
|
||||||
"version": "4.14.0",
|
"version": "4.15.0",
|
||||||
"description": "The lodash method `_.conformsTo` exported as a module.",
|
"description": "The lodash method `_.conformsTo` exported as a module.",
|
||||||
"homepage": "https://lodash.com/",
|
"homepage": "https://lodash.com/",
|
||||||
"icon": "https://lodash.com/icon.svg",
|
"icon": "https://lodash.com/icon.svg",
|
||||||
|
|||||||
Reference in New Issue
Block a user