Bump to v3.9.0.

This commit is contained in:
John-David Dalton
2015-12-16 17:50:42 -08:00
parent 26837e7fe2
commit 81e41ca0c8
89 changed files with 1033 additions and 1088 deletions

View File

@@ -60,8 +60,9 @@ define(['../internal/baseClone', '../internal/bindCallback', '../internal/isIter
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);
}
return clone;

View File

@@ -46,8 +46,9 @@ define(['../internal/baseClone', '../internal/bindCallback'], function(baseClone
* // => 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);
}
return cloneDeep;

3
lang/eq.js Normal file
View File

@@ -0,0 +1,3 @@
define(["./isEqual"], function(isEqual) {
return isEqual;
});

28
lang/gt.js Normal file
View File

@@ -0,0 +1,28 @@
define([], function() {
/**
* 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;
}
return gt;
});

28
lang/gte.js Normal file
View File

@@ -0,0 +1,28 @@
define([], function() {
/**
* 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;
}
return gte;
});

View File

@@ -1,4 +1,4 @@
define(['../internal/isLength', './isNative', '../internal/isObjectLike'], function(isLength, isNative, isObjectLike) {
define(['../internal/getNative', '../internal/isLength', '../internal/isObjectLike'], function(getNative, isLength, isObjectLike) {
/** `Object#toString` result references. */
var arrayTag = '[object Array]';
@@ -13,7 +13,7 @@ define(['../internal/isLength', './isNative', '../internal/isObjectLike'], funct
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.

View File

@@ -1,4 +1,4 @@
define(['../internal/baseIsEqual', '../internal/bindCallback', '../internal/isStrictComparable'], function(baseIsEqual, bindCallback, isStrictComparable) {
define(['../internal/baseIsEqual', '../internal/bindCallback'], function(baseIsEqual, bindCallback) {
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
var undefined;
@@ -18,6 +18,7 @@ define(['../internal/baseIsEqual', '../internal/bindCallback', '../internal/isSt
*
* @static
* @memberOf _
* @alias eq
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
@@ -47,12 +48,9 @@ define(['../internal/baseIsEqual', '../internal/bindCallback', '../internal/isSt
* // => 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;
}
return isEqual;

View File

@@ -1,8 +1,8 @@
define(['./isNative', '../internal/root'], function(isNative, root) {
define(['../internal/getNative', '../internal/root'], function(getNative, 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.

View File

@@ -1,4 +1,4 @@
define(['../internal/baseIsFunction', './isNative', '../internal/root'], function(baseIsFunction, isNative, root) {
define(['../internal/baseIsFunction', '../internal/getNative', '../internal/root'], function(baseIsFunction, getNative, root) {
/** `Object#toString` result references. */
var funcTag = '[object Function]';
@@ -13,7 +13,7 @@ define(['../internal/baseIsFunction', './isNative', '../internal/root'], functio
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.

View File

@@ -1,4 +1,4 @@
define(['../internal/baseIsMatch', '../internal/bindCallback', '../internal/isStrictComparable', '../object/keys', '../internal/toObject'], function(baseIsMatch, bindCallback, isStrictComparable, keys, toObject) {
define(['../internal/baseIsMatch', '../internal/bindCallback', '../internal/getMatchData'], function(baseIsMatch, bindCallback, getMatchData) {
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
var undefined;
@@ -43,33 +43,8 @@ define(['../internal/baseIsMatch', '../internal/bindCallback', '../internal/isSt
* // => 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);
}
return isMatch;

View File

@@ -12,6 +12,9 @@ define(['../string/escapeRegExp', '../internal/isObjectLike'], function(escapeRe
/** 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.
@@ -20,8 +23,8 @@ define(['../string/escapeRegExp', '../internal/isObjectLike'], function(escapeRe
/** 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.*?') + '$'
);
/**

View File

@@ -24,7 +24,7 @@ define([], function() {
// 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');
}
return isObject;

View File

@@ -1,4 +1,4 @@
define(['./isNative', '../internal/shimIsPlainObject'], function(isNative, shimIsPlainObject) {
define(['../internal/getNative', '../internal/shimIsPlainObject'], function(getNative, shimIsPlainObject) {
/** `Object#toString` result references. */
var objectTag = '[object Object]';
@@ -13,7 +13,7 @@ define(['./isNative', '../internal/shimIsPlainObject'], function(isNative, shimI
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
@@ -49,8 +49,8 @@ define(['./isNative', '../internal/shimIsPlainObject'], function(isNative, shimI
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)

28
lang/lt.js Normal file
View File

@@ -0,0 +1,28 @@
define([], function() {
/**
* 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;
}
return lt;
});

28
lang/lte.js Normal file
View File

@@ -0,0 +1,28 @@
define([], function() {
/**
* 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;
}
return lte;
});