mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-04 08:57:49 +00:00
Bump to v3.9.0.
This commit is contained in:
@@ -62,8 +62,9 @@ function clone(value, isDeep, customizer, thisArg) {
|
||||
customizer = isDeep;
|
||||
isDeep = false;
|
||||
}
|
||||
customizer = typeof customizer == 'function' && bindCallback(customizer, thisArg, 1);
|
||||
return baseClone(value, isDeep, customizer);
|
||||
return typeof customizer == 'function'
|
||||
? baseClone(value, isDeep, bindCallback(customizer, thisArg, 1))
|
||||
: baseClone(value, isDeep);
|
||||
}
|
||||
|
||||
export default clone;
|
||||
|
||||
@@ -47,8 +47,9 @@ import bindCallback from '../internal/bindCallback';
|
||||
* // => 20
|
||||
*/
|
||||
function cloneDeep(value, customizer, thisArg) {
|
||||
customizer = typeof customizer == 'function' && bindCallback(customizer, thisArg, 1);
|
||||
return baseClone(value, true, customizer);
|
||||
return typeof customizer == 'function'
|
||||
? baseClone(value, true, bindCallback(customizer, thisArg, 1))
|
||||
: baseClone(value, true);
|
||||
}
|
||||
|
||||
export default cloneDeep;
|
||||
|
||||
2
lang/eq.js
Normal file
2
lang/eq.js
Normal file
@@ -0,0 +1,2 @@
|
||||
import isEqual from './isEqual'
|
||||
export default isEqual;
|
||||
25
lang/gt.js
Normal file
25
lang/gt.js
Normal file
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* Checks if `value` is greater than `other`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Lang
|
||||
* @param {*} value The value to compare.
|
||||
* @param {*} other The other value to compare.
|
||||
* @returns {boolean} Returns `true` if `value` is greater than `other`, else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.gt(3, 1);
|
||||
* // => true
|
||||
*
|
||||
* _.gt(3, 3);
|
||||
* // => false
|
||||
*
|
||||
* _.gt(1, 3);
|
||||
* // => false
|
||||
*/
|
||||
function gt(value, other) {
|
||||
return value > other;
|
||||
}
|
||||
|
||||
export default gt;
|
||||
25
lang/gte.js
Normal file
25
lang/gte.js
Normal file
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* Checks if `value` is greater than or equal to `other`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Lang
|
||||
* @param {*} value The value to compare.
|
||||
* @param {*} other The other value to compare.
|
||||
* @returns {boolean} Returns `true` if `value` is greater than or equal to `other`, else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.gte(3, 1);
|
||||
* // => true
|
||||
*
|
||||
* _.gte(3, 3);
|
||||
* // => true
|
||||
*
|
||||
* _.gte(1, 3);
|
||||
* // => false
|
||||
*/
|
||||
function gte(value, other) {
|
||||
return value >= other;
|
||||
}
|
||||
|
||||
export default gte;
|
||||
@@ -1,5 +1,5 @@
|
||||
import getNative from '../internal/getNative';
|
||||
import isLength from '../internal/isLength';
|
||||
import isNative from './isNative';
|
||||
import isObjectLike from '../internal/isObjectLike';
|
||||
|
||||
/** `Object#toString` result references. */
|
||||
@@ -15,7 +15,7 @@ var objectProto = Object.prototype;
|
||||
var objToString = objectProto.toString;
|
||||
|
||||
/* Native method references for those with the same name as other `lodash` methods. */
|
||||
var nativeIsArray = isNative(nativeIsArray = Array.isArray) && nativeIsArray;
|
||||
var nativeIsArray = getNative(Array, 'isArray');
|
||||
|
||||
/**
|
||||
* Checks if `value` is classified as an `Array` object.
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import baseIsEqual from '../internal/baseIsEqual';
|
||||
import bindCallback from '../internal/bindCallback';
|
||||
import isStrictComparable from '../internal/isStrictComparable';
|
||||
|
||||
/**
|
||||
* Performs a deep comparison between two values to determine if they are
|
||||
@@ -17,6 +16,7 @@ import isStrictComparable from '../internal/isStrictComparable';
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @alias eq
|
||||
* @category Lang
|
||||
* @param {*} value The value to compare.
|
||||
* @param {*} other The other value to compare.
|
||||
@@ -46,12 +46,9 @@ import isStrictComparable from '../internal/isStrictComparable';
|
||||
* // => true
|
||||
*/
|
||||
function isEqual(value, other, customizer, thisArg) {
|
||||
customizer = typeof customizer == 'function' && bindCallback(customizer, thisArg, 3);
|
||||
if (!customizer && isStrictComparable(value) && isStrictComparable(other)) {
|
||||
return value === other;
|
||||
}
|
||||
customizer = typeof customizer == 'function' ? bindCallback(customizer, thisArg, 3) : undefined;
|
||||
var result = customizer ? customizer(value, other) : undefined;
|
||||
return result === undefined ? baseIsEqual(value, other, customizer) : !!result;
|
||||
return result === undefined ? baseIsEqual(value, other, customizer) : !!result;
|
||||
}
|
||||
|
||||
export default isEqual;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import isNative from './isNative';
|
||||
import getNative from '../internal/getNative';
|
||||
import root from '../internal/root';
|
||||
|
||||
/* Native method references for those with the same name as other `lodash` methods. */
|
||||
var nativeIsFinite = root.isFinite,
|
||||
nativeNumIsFinite = isNative(nativeNumIsFinite = Number.isFinite) && nativeNumIsFinite;
|
||||
nativeNumIsFinite = getNative(Number, 'isFinite');
|
||||
|
||||
/**
|
||||
* Checks if `value` is a finite primitive number.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import baseIsFunction from '../internal/baseIsFunction';
|
||||
import isNative from './isNative';
|
||||
import getNative from '../internal/getNative';
|
||||
import root from '../internal/root';
|
||||
|
||||
/** `Object#toString` result references. */
|
||||
@@ -15,7 +15,7 @@ var objectProto = Object.prototype;
|
||||
var objToString = objectProto.toString;
|
||||
|
||||
/** Native method references. */
|
||||
var Uint8Array = isNative(Uint8Array = root.Uint8Array) && Uint8Array;
|
||||
var Uint8Array = getNative(root, 'Uint8Array');
|
||||
|
||||
/**
|
||||
* Checks if `value` is classified as a `Function` object.
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import baseIsMatch from '../internal/baseIsMatch';
|
||||
import bindCallback from '../internal/bindCallback';
|
||||
import isStrictComparable from '../internal/isStrictComparable';
|
||||
import keys from '../object/keys';
|
||||
import toObject from '../internal/toObject';
|
||||
import getMatchData from '../internal/getMatchData';
|
||||
|
||||
/**
|
||||
* Performs a deep comparison between `object` and `source` to determine if
|
||||
@@ -44,33 +42,8 @@ import toObject from '../internal/toObject';
|
||||
* // => true
|
||||
*/
|
||||
function isMatch(object, source, customizer, thisArg) {
|
||||
var props = keys(source),
|
||||
length = props.length;
|
||||
|
||||
if (!length) {
|
||||
return true;
|
||||
}
|
||||
if (object == null) {
|
||||
return false;
|
||||
}
|
||||
customizer = typeof customizer == 'function' && bindCallback(customizer, thisArg, 3);
|
||||
object = toObject(object);
|
||||
if (!customizer && length == 1) {
|
||||
var key = props[0],
|
||||
value = source[key];
|
||||
|
||||
if (isStrictComparable(value)) {
|
||||
return value === object[key] && (value !== undefined || (key in object));
|
||||
}
|
||||
}
|
||||
var values = Array(length),
|
||||
strictCompareFlags = Array(length);
|
||||
|
||||
while (length--) {
|
||||
value = values[length] = source[props[length]];
|
||||
strictCompareFlags[length] = isStrictComparable(value);
|
||||
}
|
||||
return baseIsMatch(object, props, values, strictCompareFlags, customizer);
|
||||
customizer = typeof customizer == 'function' ? bindCallback(customizer, thisArg, 3) : undefined;
|
||||
return baseIsMatch(object, getMatchData(source), customizer);
|
||||
}
|
||||
|
||||
export default isMatch;
|
||||
|
||||
@@ -13,6 +13,9 @@ var objectProto = Object.prototype;
|
||||
/** Used to resolve the decompiled source of functions. */
|
||||
var fnToString = Function.prototype.toString;
|
||||
|
||||
/** Used to check objects for own properties. */
|
||||
var hasOwnProperty = objectProto.hasOwnProperty;
|
||||
|
||||
/**
|
||||
* Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring)
|
||||
* of values.
|
||||
@@ -21,8 +24,8 @@ var objToString = objectProto.toString;
|
||||
|
||||
/** Used to detect if a method is native. */
|
||||
var reIsNative = RegExp('^' +
|
||||
escapeRegExp(objToString)
|
||||
.replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
|
||||
escapeRegExp(fnToString.call(hasOwnProperty))
|
||||
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
|
||||
);
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,7 +22,7 @@ function isObject(value) {
|
||||
// Avoid a V8 JIT bug in Chrome 19-20.
|
||||
// See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
|
||||
var type = typeof value;
|
||||
return type == 'function' || (!!value && type == 'object');
|
||||
return !!value && (type == 'object' || type == 'function');
|
||||
}
|
||||
|
||||
export default isObject;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import isNative from './isNative';
|
||||
import getNative from '../internal/getNative';
|
||||
import shimIsPlainObject from '../internal/shimIsPlainObject';
|
||||
|
||||
/** `Object#toString` result references. */
|
||||
@@ -14,7 +14,7 @@ var objectProto = Object.prototype;
|
||||
var objToString = objectProto.toString;
|
||||
|
||||
/** Native method references. */
|
||||
var getPrototypeOf = isNative(getPrototypeOf = Object.getPrototypeOf) && getPrototypeOf;
|
||||
var getPrototypeOf = getNative(Object, 'getPrototypeOf');
|
||||
|
||||
/**
|
||||
* Checks if `value` is a plain object, that is, an object created by the
|
||||
@@ -50,8 +50,8 @@ var isPlainObject = !getPrototypeOf ? shimIsPlainObject : function(value) {
|
||||
if (!(value && objToString.call(value) == objectTag)) {
|
||||
return false;
|
||||
}
|
||||
var valueOf = value.valueOf,
|
||||
objProto = isNative(valueOf) && (objProto = getPrototypeOf(valueOf)) && getPrototypeOf(objProto);
|
||||
var valueOf = getNative(value, 'valueOf'),
|
||||
objProto = valueOf && (objProto = getPrototypeOf(valueOf)) && getPrototypeOf(objProto);
|
||||
|
||||
return objProto
|
||||
? (value == objProto || getPrototypeOf(value) == objProto)
|
||||
|
||||
25
lang/lt.js
Normal file
25
lang/lt.js
Normal file
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* Checks if `value` is less than `other`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Lang
|
||||
* @param {*} value The value to compare.
|
||||
* @param {*} other The other value to compare.
|
||||
* @returns {boolean} Returns `true` if `value` is less than `other`, else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.lt(1, 3);
|
||||
* // => true
|
||||
*
|
||||
* _.lt(3, 3);
|
||||
* // => false
|
||||
*
|
||||
* _.lt(3, 1);
|
||||
* // => false
|
||||
*/
|
||||
function lt(value, other) {
|
||||
return value < other;
|
||||
}
|
||||
|
||||
export default lt;
|
||||
25
lang/lte.js
Normal file
25
lang/lte.js
Normal file
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* Checks if `value` is less than or equal to `other`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Lang
|
||||
* @param {*} value The value to compare.
|
||||
* @param {*} other The other value to compare.
|
||||
* @returns {boolean} Returns `true` if `value` is less than or equal to `other`, else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.lte(1, 3);
|
||||
* // => true
|
||||
*
|
||||
* _.lte(3, 3);
|
||||
* // => true
|
||||
*
|
||||
* _.lte(3, 1);
|
||||
* // => false
|
||||
*/
|
||||
function lte(value, other) {
|
||||
return value <= other;
|
||||
}
|
||||
|
||||
export default lte;
|
||||
Reference in New Issue
Block a user