Simplify Object.defineProperty use.

This commit is contained in:
John-David Dalton
2015-12-28 13:15:43 -06:00
parent 5a53215506
commit 43469b9877

View File

@@ -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; }