mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-03 16:47:49 +00:00
Fix test fails in older Safari and cleanup setProperty in test.js.
This commit is contained in:
19
test/test.js
19
test/test.js
@@ -213,23 +213,20 @@
|
||||
* @param {string} key The name of the property to set.
|
||||
* @param {*} value The property value.
|
||||
*/
|
||||
var setProperty = (function() {
|
||||
if (!defineProperty) {
|
||||
return function(object, key, value) {
|
||||
object[key] = value;
|
||||
};
|
||||
}
|
||||
return function(object, key, value) {
|
||||
// avoid a bug where overwriting non-enumerable built-ins makes them enumerable
|
||||
// https://code.google.com/p/v8/issues/detail?id=1623
|
||||
function setProperty(object, key, value) {
|
||||
// avoid a bug where overwriting non-enumerable built-ins makes them enumerable
|
||||
// https://code.google.com/p/v8/issues/detail?id=1623
|
||||
try {
|
||||
defineProperty(object, key, {
|
||||
'configurable': true,
|
||||
'enumerable': false,
|
||||
'writable': true,
|
||||
'value': value
|
||||
});
|
||||
};
|
||||
}());
|
||||
} catch(e) {
|
||||
object[key] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Skips a given number of tests with a passing result.
|
||||
|
||||
Reference in New Issue
Block a user