Bump to v3.3.0.

This commit is contained in:
John-David Dalton
2015-12-16 17:46:57 -08:00
parent 3ccb5e7da3
commit f8e4370129
91 changed files with 826 additions and 401 deletions

View File

@@ -38,22 +38,26 @@ define(['../internal/baseClone', '../internal/bindCallback', '../internal/isIter
* // => false
*
* // using a customizer callback
* var body = _.clone(document.body, function(value) {
* return _.isElement(value) ? value.cloneNode(false) : undefined;
* var el = _.clone(document.body, function(value) {
* if (_.isElement(value)) {
* return value.cloneNode(false);
* }
* });
*
* body === document.body
* el === document.body
* // => false
* body.nodeName
* el.nodeName
* // => BODY
* body.childNodes.length;
* el.childNodes.length;
* // => 0
*/
function clone(value, isDeep, customizer, thisArg) {
// Juggle arguments.
if (typeof isDeep != 'boolean' && isDeep != null) {
if (isDeep && typeof isDeep != 'boolean' && isIterateeCall(value, isDeep, customizer)) {
isDeep = false;
}
else if (typeof isDeep == 'function') {
thisArg = customizer;
customizer = isIterateeCall(value, isDeep, thisArg) ? null : isDeep;
customizer = isDeep;
isDeep = false;
}
customizer = typeof customizer == 'function' && bindCallback(customizer, thisArg, 1);

View File

@@ -33,14 +33,16 @@ define(['../internal/baseClone', '../internal/bindCallback'], function(baseClone
*
* // using a customizer callback
* var el = _.cloneDeep(document.body, function(value) {
* return _.isElement(value) ? value.cloneNode(true) : undefined;
* if (_.isElement(value)) {
* return value.cloneNode(true);
* }
* });
*
* body === document.body
* el === document.body
* // => false
* body.nodeName
* el.nodeName
* // => BODY
* body.childNodes.length;
* el.childNodes.length;
* // => 20
*/
function cloneDeep(value, customizer, thisArg) {

View File

@@ -26,7 +26,7 @@ define(['../internal/isLength', '../internal/isObjectLike'], function(isLength,
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* (function() { return _.isArguments(arguments); })();
* _.isArguments(function() { return arguments; }());
* // => true
*
* _.isArguments([1, 2, 3]);

View File

@@ -29,7 +29,7 @@ define(['../internal/isLength', './isNative', '../internal/isObjectLike'], funct
* _.isArray([1, 2, 3]);
* // => true
*
* (function() { return _.isArray(arguments); })();
* _.isArray(function() { return arguments; }());
* // => false
*/
var isArray = nativeIsArray || function(value) {

View File

@@ -40,7 +40,9 @@ define(['../internal/baseIsEqual', '../internal/bindCallback', '../internal/isSt
* var other = ['hi', 'goodbye'];
*
* _.isEqual(array, other, function(value, other) {
* return _.every([value, other], RegExp.prototype.test, /^h(?:i|ello)$/) || undefined;
* if (_.every([value, other], RegExp.prototype.test, /^h(?:i|ello)$/)) {
* return true;
* }
* });
* // => true
*/

View File

@@ -1,4 +1,4 @@
define(['./isNative', '../internal/root'], function(isNative, root) {
define(['../internal/baseIsFunction', './isNative', '../internal/root'], function(baseIsFunction, isNative, root) {
/** `Object#toString` result references. */
var funcTag = '[object Function]';
@@ -32,20 +32,12 @@ define(['./isNative', '../internal/root'], function(isNative, root) {
* _.isFunction(/abc/);
* // => false
*/
function isFunction(value) {
// Avoid a Chakra JIT bug in compatibility modes of IE 11.
// See https://github.com/jashkenas/underscore/issues/1621 for more details.
return typeof value == 'function' || false;
}
// Fallback for environments that return incorrect `typeof` operator results.
if (isFunction(/x/) || (Uint8Array && !isFunction(Uint8Array))) {
isFunction = function(value) {
// The use of `Object#toString` avoids issues with the `typeof` operator
// in older versions of Chrome and Safari which return 'function' for regexes
// and Safari 8 equivalents which return 'object' for typed array constructors.
return objToString.call(value) == funcTag;
};
}
var isFunction = !(baseIsFunction(/x/) || (Uint8Array && !baseIsFunction(Uint8Array))) ? baseIsFunction : function(value) {
// The use of `Object#toString` avoids issues with the `typeof` operator
// in older versions of Chrome and Safari which return 'function' for regexes
// and Safari 8 equivalents which return 'object' for typed array constructors.
return objToString.call(value) == funcTag;
};
return isFunction;
});

View File

@@ -10,7 +10,9 @@ define(['../internal/arrayCopy', '../internal/isLength', '../object/values'], fu
* @returns {Array} Returns the converted array.
* @example
*
* (function() { return _.toArray(arguments).slice(1); })(1, 2, 3);
* (function() {
* return _.toArray(arguments).slice(1);
* }(1, 2, 3));
* // => [2, 3]
*/
function toArray(value) {