mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 10:07:48 +00:00
Wrap support.nonEnumArgs assignment in a try-catch to avoid errors in Ringo, Rhino, and Narwhal.
This commit is contained in:
34
lodash.js
34
lodash.js
@@ -875,21 +875,6 @@
|
|||||||
*/
|
*/
|
||||||
support.funcNames = typeof Function.name == 'string';
|
support.funcNames = typeof Function.name == 'string';
|
||||||
|
|
||||||
/**
|
|
||||||
* 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') &&
|
|
||||||
propertyIsEnumerable.call(arguments, '1'));
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Detect if string indexes are non-enumerable
|
* Detect if string indexes are non-enumerable
|
||||||
* (IE < 9, RingoJS, Rhino, Narwhal).
|
* (IE < 9, RingoJS, Rhino, Narwhal).
|
||||||
@@ -972,6 +957,25 @@
|
|||||||
} catch(e) {
|
} catch(e) {
|
||||||
support.nodeClass = true;
|
support.nodeClass = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
try {
|
||||||
|
support.nonEnumArgs = !(argsKey == '1' && hasOwnProperty.call(arguments, '1') &&
|
||||||
|
propertyIsEnumerable.call(arguments, '1'));
|
||||||
|
} catch(e) {
|
||||||
|
support.nonEnumArgs = true;
|
||||||
|
}
|
||||||
}(0, 0));
|
}(0, 0));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user