From 3225f17f5ac7dcddbb9d3e91d59535cf541fbb72 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Tue, 1 Apr 2014 23:28:23 -0700 Subject: [PATCH] Comment and cleanup `support` properties. --- lodash.js | 42 ++++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/lodash.js b/lodash.js index 1d235c5c5..2b98a1b54 100644 --- a/lodash.js +++ b/lodash.js @@ -818,7 +818,8 @@ for (var strKey in 'x') { } /** - * Detect if an `arguments` object's `[[Class]]` is resolvable (all but Firefox < 4, IE < 9). + * Detect if an `arguments` object's `[[Class]]` is resolvable + * (all but Firefox < 4, IE < 9). * * @memberOf _.support * @type boolean @@ -826,7 +827,8 @@ support.argsClass = toString.call(arguments) == argsClass; /** - * Detect if `arguments` objects are `Object` objects (all but Narwhal and Opera < 10.5). + * Detect if `arguments` objects are `Object` objects + * (all but Narwhal and Opera < 10.5). * * @memberOf _.support * @type boolean @@ -840,7 +842,8 @@ * @memberOf _.support * @type boolean */ - support.enumErrorProps = propertyIsEnumerable.call(errorProto, 'message') || propertyIsEnumerable.call(errorProto, 'name'); + support.enumErrorProps = propertyIsEnumerable.call(errorProto, 'message') || + propertyIsEnumerable.call(errorProto, 'name'); /** * Detect if `prototype` properties are enumerable by default. @@ -876,13 +879,20 @@ * Detect if `arguments` object indexes are non-enumerable * (Firefox < 4, IE < 9, PhantomJS, Safari < 5.1). * + * Chrome < 25 and Node.js < 0.11.0 will treat `arguments` object indexes + * that exceed their function's formal parameters and whose associated + * values are `0` as non-enumerable and incorrectly return `false` from + * `Object#hasOwnProperty`. + * * @memberOf _.support * @type boolean */ - support.nonEnumArgs = !(argsKey == '1' && hasOwnProperty.call(arguments, '1')); + support.nonEnumArgs = !(argsKey == '1' && hasOwnProperty.call(arguments, '1') && + propertyIsEnumerable.call(arguments, '1')); /** - * Detect if string indexes are non-enumerable (IE < 9, RingoJS, Rhino, Narwhal). + * Detect if string indexes are non-enumerable + * (IE < 9, RingoJS, Rhino, Narwhal). * * @memberOf _.support * @type boolean @@ -890,10 +900,11 @@ support.nonEnumStrings = strKey != '0'; /** - * Detect if properties shadowing those on `Object.prototype` are non-enumerable. + * Detect if properties shadowing those on `Object.prototype` are + * non-enumerable. * - * In IE < 9 an objects own properties, shadowing non-enumerable ones, are - * made non-enumerable as well (a.k.a the JScript `[[DontEnum]]` bug). + * In IE < 9 an object's own properties, shadowing non-enumerable ones, + * are made non-enumerable as well (a.k.a the JScript `[[DontEnum]]` bug). * * @memberOf _.support * @type boolean @@ -901,7 +912,8 @@ support.nonEnumShadows = !/valueOf/.test(props); /** - * Detect if own properties are iterated after inherited properties (all but IE < 9). + * Detect if own properties are iterated after inherited properties + * (all but IE < 9). * * @memberOf _.support * @type boolean @@ -909,13 +921,15 @@ support.ownLast = props[0] != 'x'; /** - * Detect if `Array#shift` and `Array#splice` augment array-like objects correctly. + * Detect if `Array#shift` and `Array#splice` augment array-like objects + * correctly. * * Firefox < 10, IE compatibility mode, and IE < 9 have buggy Array `shift()` * and `splice()` functions that fail to remove the last element, `value[0]`, * of array-like objects even though the `length` property is set to `0`. * The `shift()` method is buggy in IE 8 compatibility mode, while `splice()` - * is buggy regardless of mode in IE < 9 and buggy in compatibility mode in IE 9. + * is buggy regardless of mode in IE < 9 and buggy in compatibility mode + * in IE 9. * * @memberOf _.support * @type boolean @@ -961,9 +975,9 @@ }(0, 0)); /** - * By default, the template delimiters used by Lo-Dash are similar to those in - * embedded Ruby (ERB). Change the following template settings to use alternative - * delimiters. + * By default, the template delimiters used by Lo-Dash are similar to those + * in embedded Ruby (ERB). Change the following template settings to use + * alternative delimiters. * * @static * @memberOf _