From faf91688516e04122ee55aaeaaa960f5a3d2043a Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sun, 22 Apr 2012 21:50:14 -0400 Subject: [PATCH] lodash: Update isNaN to pass IE unit test. [jddalton] Former-commit-id: fba56af41dc05b325e809cbcfff8c5f626468cf0 --- doc/README.md | 48 ++++++++++++++++++++++++------------------------ lodash.js | 5 +++-- lodash.min.js | 2 +- 3 files changed, 28 insertions(+), 27 deletions(-) diff --git a/doc/README.md b/doc/README.md index 49d2ff4da..fa04659bc 100644 --- a/doc/README.md +++ b/doc/README.md @@ -139,7 +139,7 @@ The `lodash` function. -### `_.VERSION` +### `_.VERSION` *(String)*: The semantic version number. [▲][1] @@ -226,7 +226,7 @@ jQuery('#lodash_button').on('click', buttonView.onClick); -### `_.chain()` +### `_.chain()` Extracts the value from a wrapped chainable object. [▲][1] @@ -244,7 +244,7 @@ _([1, 2, 3]).value(); -### `_.chain(value)` +### `_.chain(value)` Wraps the value in a `lodash` chainable object. [▲][1] @@ -477,7 +477,7 @@ _.difference([1, 2, 3, 4, 5], [5, 2, 10]); -### `_.escape(string)` +### `_.escape(string)` Escapes a string for insertion into HTML, replacing `&`, `<`, `>`, `"`, `'`, and `/` characters. [▲][1] @@ -732,7 +732,7 @@ _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b'); -### `_.identity(value)` +### `_.identity(value)` This function simply returns the first argument passed to it. Note: It is used throughout Lo-Dash as a default callback. [▲][1] @@ -1086,7 +1086,7 @@ _.isNaN(undefined); -### `_.isNull(value)` +### `_.isNull(value)` Checks if a `value` is `null`. [▲][1] @@ -1110,7 +1110,7 @@ _.isNull(undefined); -### `_.isNumber(value)` +### `_.isNumber(value)` Checks if a `value` is a number. [▲][1] @@ -1155,7 +1155,7 @@ _.isObject(1); -### `_.isRegExp(value)` +### `_.isRegExp(value)` Checks if a `value` is a regular expression. [▲][1] @@ -1176,7 +1176,7 @@ _.isRegExp(/moe/); -### `_.isString(value)` +### `_.isString(value)` Checks if a `value` is a string. [▲][1] @@ -1197,7 +1197,7 @@ _.isString('moe'); -### `_.isUndefined(value)` +### `_.isUndefined(value)` Checks if a `value` is `undefined`. [▲][1] @@ -1218,7 +1218,7 @@ _.isUndefined(void 0); -### `_.keys(object)` +### `_.keys(object)` Produces an array of the `object`'s enumerable own property names. [▲][1] @@ -1385,7 +1385,7 @@ _.min([10, 5, 100, 2, 1000]); -### `_.mixin(object)` +### `_.mixin(object)` Adds functions properties of `object` to the `lodash` function and chainable wrapper. [▲][1] @@ -1412,7 +1412,7 @@ _('larry').capitalize(); -### `_.noConflict()` +### `_.noConflict()` Reverts the '_' variable to its previous value and returns a reference to the `lodash` function. [▲][1] @@ -1452,7 +1452,7 @@ initialize(); -### `_.pick(object [, prop1, prop2, ..])` +### `_.pick(object [, prop1, prop2, ..])` Creates an object composed of the specified properties. Property names may be specified as individual arguments or as arrays of property names. [▲][1] @@ -1632,7 +1632,7 @@ _.rest([5, 4, 3, 2, 1]); -### `_.result(object, property)` +### `_.result(object, property)` Resolves the value of `property` on `object`. If the property is a function it will be invoked and its result returned, else the property value is returned. [▲][1] @@ -1775,7 +1775,7 @@ _.sortedIndex([10, 20, 30, 40, 50], 35); -### `_.tap(value, interceptor)` +### `_.tap(value, interceptor)` Invokes `interceptor` with the `value` as the first argument, and then returns `value`. The primary purpose of this method is to "tap into" a method chain, in order to performoperations on intermediate results within the chain. [▲][1] @@ -1802,7 +1802,7 @@ _.chain([1,2,3,200]) -### `_.template(text, data, options)` +### `_.template(text, data, options)` A JavaScript micro-templating method, similar to John Resig's implementation. Lo-Dash templating handles arbitrary delimiters, preserves whitespace, and correctly escapes quotes within interpolated code. [▲][1] @@ -1881,7 +1881,7 @@ jQuery(window).on('scroll', throttled); -### `_.times(n, callback [, thisArg])` +### `_.times(n, callback [, thisArg])` Executes the `callback` function `n` times. [▲][1] @@ -1965,7 +1965,7 @@ _.uniq([1, 2, 1, 3, 1, 4]); -### `_.uniqueId([prefix])` +### `_.uniqueId([prefix])` Generates a unique id. If `prefix` is passed, the id will be appended to it. [▲][1] @@ -1986,7 +1986,7 @@ _.uniqueId('contact_'); -### `_.value()` +### `_.value()` Extracts the value from a wrapped chainable object. [▲][1] @@ -2102,7 +2102,7 @@ _.zip(['moe', 'larry', 'curly'], [30, 40, 50], [true, false, false]); -### `_.templateSettings` +### `_.templateSettings` *(Object)*: By default, Lo-Dash uses ERB-style template delimiters, change the following template settings to use alternative delimiters. [▲][1] @@ -2111,7 +2111,7 @@ _.zip(['moe', 'larry', 'curly'], [30, 40, 50], [true, false, false]); -### `_.templateSettings.escape` +### `_.templateSettings.escape` *(RegExp)*: Used to detect `data` property values to be HTML-escaped. [▲][1] @@ -2120,7 +2120,7 @@ _.zip(['moe', 'larry', 'curly'], [30, 40, 50], [true, false, false]); -### `_.templateSettings.evaluate` +### `_.templateSettings.evaluate` *(RegExp)*: Used to detect code to be evaluated. [▲][1] @@ -2129,7 +2129,7 @@ _.zip(['moe', 'larry', 'curly'], [30, 40, 50], [true, false, false]); -### `_.templateSettings.interpolate` +### `_.templateSettings.interpolate` *(RegExp)*: Used to detect `data` property values to inject. [▲][1] diff --git a/lodash.js b/lodash.js index 2ca585dcf..ab2e32f2a 100644 --- a/lodash.js +++ b/lodash.js @@ -1868,7 +1868,7 @@ if (b.isEqual && isFunction(b.isEqual)) { return b.isEqual(a); } - // compare `[[Class]]` names + // compare [[Class]] names var className = toString.call(a); if (className != toString.call(b)) { return false; @@ -2052,7 +2052,8 @@ */ function isNaN(value) { // `NaN` as a primitive is the only value that is not equal to itself - return value != +value && toString.call(value) == numberClass; + // (perform the [[Class]] check first to avoid errors with some host objects in IE) + return toString.call(value) == numberClass && value != +value } /** diff --git a/lodash.min.js b/lodash.min.js index 44701cd04..2316af913 100644 --- a/lodash.min.js +++ b/lodash.min.js @@ -16,7 +16,7 @@ x={m:"var j,y=-q,h=y;if(!e){if(s(g)&&g[0]===+g[0])return w.max.apply(w,g);if(t(g l:"y.sort()"});E(arguments)||(E=function(a){return!(!a||!r.call(a,"callee"))});var T=N||g(oa);Q(i,{VERSION:"0.1.0",templateSettings:{escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g},after:function(a,b){return 1>a?b():function(){if(1>--a)return b.apply(this,arguments)}},bind:u,bindAll:function(a){var b=arguments,c=1;1==b.length&&(c=0,b=M(a));for(var d=b.length;c/g,">").replace(/"/g, """).replace(/'/g,"'").replace(/\//g,"/")},every:X,extend:Q,filter:W,find:qa,first:U,flatten:I,forEach:s,functions:M,groupBy:function(a,b){var c={};if(!q(b))var d=b,b=function(a){return a[d]};s(a,function(a,e,d){e=b(a,e,d);(c[e]||(c[e]=[])).push(a)});return c},has:function(a,b){return r.call(a,b)},identity:R,indexOf:G,initial:function(a,b,c){return l.call(a,0,-(b==h||c?1:b))},intersection:ga,invoke:function(a,b){var c=l.call(arguments,2),d=q(b);return B(a,function(a){return(d?b||a: -a[b]).apply(a,c)})},isArguments:E,isArray:y,isBoolean:function(a){return a===n||a===o||k.call(a)==ka},isDate:function(a){return k.call(a)==la},isElement:function(a){return!!(a&&1==a.nodeType)},isEmpty:da,isEqual:Y,isFinite:function(a){return za(a)&&k.call(a)==L},isFunction:q,isNaN:function(a){return a!=+a&&k.call(a)==L},isNull:function(a){return null===a},isNumber:function(a){return k.call(a)==L},isObject:function(a){return a===Object(a)},isRegExp:function(a){return k.call(a)==ma},isString:function(a){return k.call(a)== +a[b]).apply(a,c)})},isArguments:E,isArray:y,isBoolean:function(a){return a===n||a===o||k.call(a)==ka},isDate:function(a){return k.call(a)==la},isElement:function(a){return!!(a&&1==a.nodeType)},isEmpty:da,isEqual:Y,isFinite:function(a){return za(a)&&k.call(a)==L},isFunction:q,isNaN:function(a){return k.call(a)==L&&a!=+a},isNull:function(a){return null===a},isNumber:function(a){return k.call(a)==L},isObject:function(a){return a===Object(a)},isRegExp:function(a){return k.call(a)==ma},isString:function(a){return k.call(a)== H},isUndefined:function(a){return a===h},keys:T,last:ha,lastIndexOf:function(a,b){if(a==h)return-1;for(var c=a.length;c--;)if(a[c]===b)return c;return-1},map:B,max:ra,memoize:function(a,b){var c={};return function(){var d=b?b.apply(this,arguments):arguments[0];return r.call(c,d)?c[d]:c[d]=a.apply(this,arguments)}},min:x,mixin:na,noConflict:function(){t._=xa;return this},once:function(a){var b,c=o;return function(){if(c)return b;c=n;return b=a.apply(this,arguments)}},pick:function(a){for(var b,c=-1, d=I(l.call(arguments,1)),f=d.length,e={};++carguments.length&&(b=a||0,a=0);for(var d=-1,f=Math.max(Math.ceil((b-a)/c),0),e=Array(f);++dd?1:0}),"b")},sortedIndex:fa,tap:function(a,b){b(a);return a},template:function(a,b,c){function d(a){return f.call(this,a,i)}c=ta(c||{},i.templateSettings);a="__p+='"+a.replace(ya,function(a){return"\\"+z[a]}).replace(c.escape||$,function(a,b){return"'+((__t=("+