Skip to content

Instantly share code, notes, and snippets.

@medikoo
Created May 18, 2013 11:11
Show Gist options
  • Save medikoo/5604080 to your computer and use it in GitHub Desktop.
Save medikoo/5604080 to your computer and use it in GitHub Desktop.
Descriptors helper
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