From 98eccf223afda8dcaf97d3bacd7696493120d511 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Fri, 25 Jan 2013 00:20:55 -0800 Subject: [PATCH] Simplify `null`/`undefined` check in `_.isEqual` and edit `_.cloneDeep` docs. Former-commit-id: 62455ba83df04318856fbc889743f44101b24fe3 --- doc/README.md | 2 +- lodash.js | 10 +++++----- lodash.min.js | 2 +- lodash.underscore.js | 8 ++++---- lodash.underscore.min.js | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/doc/README.md b/doc/README.md index bd472e767..9fe503e78 100644 --- a/doc/README.md +++ b/doc/README.md @@ -1984,7 +1984,7 @@ deep[0] === stooges[0]; Creates a deep clone of `value`. Functions and DOM nodes are **not** cloned. The enumerable properties of `arguments` objects and objects created by constructors other than `Object` are cloned to plain `Object` objects. -Note: This function is loosely based on the structured clone algorithm. See http://www.w3.org/TR/html5/common-dom-interfaces.html#internal-structured-cloning-algorithm. +Note: This function is loosely based on the structured clone algorithm. See http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm. #### Arguments 1. `value` *(Mixed)*: The value to deep clone. diff --git a/lodash.js b/lodash.js index b653d54e0..bbf5d29f2 100644 --- a/lodash.js +++ b/lodash.js @@ -653,7 +653,7 @@ * * @private * @param {Object} [options1, options2, ...] The compile options object(s). - * arrays - A boolean to specify support for iterating arrays and array-like objects. + * arrays - A string of code to determine if the iteratee is an array or array-like. * useHas - A boolean to specify using `hasOwnProperty` checks in the object loop. * args - A string of comma separated arguments the iteration function will accept. * top - A string of code to execute before the iteration branches. @@ -672,7 +672,7 @@ 'shadowed': shadowed, // iterator options - 'arrays': "isArray(iteratee)", + 'arrays': 'isArray(iteratee)', 'bottom': '', 'loop': '', 'top': '', @@ -1129,7 +1129,7 @@ * constructors other than `Object` are cloned to plain `Object` objects. * * Note: This function is loosely based on the structured clone algorithm. - * See http://www.w3.org/TR/html5/common-dom-interfaces.html#internal-structured-cloning-algorithm. + * See http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm. * * @static * @memberOf _ @@ -1366,9 +1366,9 @@ // treat `+0` vs. `-0` as not equal return a !== 0 || (1 / a == 1 / b); } - // a strict comparison is necessary because `null == undefined` + // exit early for unlike `null` or `undefined` values if (a == null || b == null) { - return a === b; + return false; } // compare [[Class]] names var className = toString.call(a), diff --git a/lodash.min.js b/lodash.min.js index 96db0e590..064be52c5 100644 --- a/lodash.min.js +++ b/lodash.min.js @@ -9,7 +9,7 @@ for(var u=0;7>u;u++)e+="i='"+t.j[u]+"';if(","constructor"==t.j[u]&&(e+="!(f&&f.prototype===m)&&"),e+="h.call(m,i)){"+t.g+"}"}return(t.b||t.h)&&(e+="}"),e+=t.c+";return u",r("e,h,j,k,l,q,o,t","return function("+n+"){"+e+"}")(a,wt,h,fr,A,nr,Nt,xt)}function c(n){return"\\"+tr[n]}function l(n){return lr[n]}function p(n){return typeof n.toString!="function"&&typeof(n+"")=="string"}function s(){}function v(n,t,r){t||(t=0),typeof r=="undefined"&&(r=n?n.length:0);var e=-1;r=r-t||0;for(var u=Array(0>r?0:r);++er?Rt(0,u+r):r)||0,typeof u=="number"?o=-1<(A(n)?n.indexOf(t,r):C(n,t,r)):or(n,function(n){return++er||typeof n=="undefined")return 1;if(nt?0:t);++eo&&(o=f)}}else r=i(r,t),e(n,function(n,t,e){t=r(n,t,e),t>u&&(u=t,o=n)});return o}function F(n,r){return N(n,r+"")