Created
May 18, 2013 11:11
-
-
Save medikoo/5604080 to your computer and use it in GitHub Desktop.
Descriptors helper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var d = require('es5-ext/lib/Object/descriptor'); | |
// with helper | |
Object.defineProperties(obj, { | |
simple: d(value), | |
getter: d.gs(function () { return this.a + this.b; }), | |
}); | |
// without helper | |
Object.defineProperties(obj, { | |
simple: { value: value, enumerable: false, configurable: true, writable: true }, | |
getter: { get: function () { reutrn this.a + this.b }, enumerable: false, configurable: true } | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment