mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-02 08:07:50 +00:00
Simplify Object.defineProperty use.
This commit is contained in:
13
test/test.js
13
test/test.js
@@ -44,6 +44,7 @@
|
||||
amd = root.define && define.amd,
|
||||
argv = root.process && process.argv,
|
||||
ArrayBuffer = root.ArrayBuffer,
|
||||
defineProperty = Object.defineProperty,
|
||||
document = !phantom && root.document,
|
||||
body = root.document && root.document.body,
|
||||
create = Object.create,
|
||||
@@ -69,16 +70,6 @@
|
||||
isEven = function(n) { return n % 2 == 0; },
|
||||
square = function(n) { return n * n; };
|
||||
|
||||
/** Used to set property descriptors. */
|
||||
var defineProperty = (function() {
|
||||
try {
|
||||
var o = {},
|
||||
func = Object.defineProperty,
|
||||
result = func(o, o, o) && func;
|
||||
} catch (e) {}
|
||||
return result;
|
||||
}());
|
||||
|
||||
/** The file path of the lodash file to test. */
|
||||
var filePath = (function() {
|
||||
var min = 2,
|
||||
@@ -183,7 +174,7 @@
|
||||
|
||||
/** Poison the free variable `root` in Node.js */
|
||||
try {
|
||||
Object.defineProperty(global.root, 'root', {
|
||||
defineProperty(global.root, 'root', {
|
||||
'configurable': false,
|
||||
'enumerable': false,
|
||||
'get': function() { throw new ReferenceError; }
|
||||
|
||||
Reference in New Issue
Block a user