return Object.defineProperties without a closure in property methods assignment unless it's really necessary

This commit is contained in:
Sebastian McKenzie
2015-01-02 00:42:28 +11:00
parent 5b6c0fcacd
commit e268dc6138
4 changed files with 42 additions and 47 deletions

View File

@@ -1,17 +1,13 @@
"use strict";
var obj = (function (_obj) {
Object.defineProperties(_obj, {
foo: {
get: function () {
return 5 + 5;
},
set: function (value) {
this._foo = value;
},
enumerable: true
}
});
return _obj;
})({});
var obj = Object.defineProperties({}, {
foo: {
get: function () {
return 5 + 5;
},
set: function (value) {
this._foo = value;
},
enumerable: true
}
});

View File

@@ -1,14 +1,10 @@
"use strict";
var obj = (function (_obj) {
Object.defineProperties(_obj, {
foo: {
get: function () {
return 5 + 5;
},
enumerable: true
}
});
return _obj;
})({});
var obj = Object.defineProperties({}, {
foo: {
get: function () {
return 5 + 5;
},
enumerable: true
}
});

View File

@@ -1,14 +1,10 @@
"use strict";
var obj = (function (_obj) {
Object.defineProperties(_obj, {
foo: {
set: function (value) {
this._foo = value;
},
enumerable: true
}
});
return _obj;
})({});
var obj = Object.defineProperties({}, {
foo: {
set: function (value) {
this._foo = value;
},
enumerable: true
}
});