{"maintainers":[{"name":"medikoo","email":"medikoo+npm@medikoo.com"}],"keywords":["descriptor","es","ecmascript","ecma","property","descriptors","meta","properties"],"dist-tags":{"latest":"1.0.0"},"author":{"name":"Mariusz Nowak","email":"medyk@medikoo.com","url":"http://www.medikoo.com/"},"description":"Property descriptor factory","readme":"# D\n## Property descriptor factory\n\n_Originally derived from [es5-ext](https://github.com/medikoo/es5-ext) package._\n\nDefining properties with descriptors is very verbose:\n\n```javascript\nvar Account = function () {};\nObject.defineProperties(Account.prototype, {\n  deposit: { value: function () {\n      /* ... */\n    }, configurable: true, enumerable: false, writable: true },\n  withdraw: { value: function () {\n      /* ... */\n    }, configurable: true, enumerable: false, writable: true },\n  balance: { get: function () {\n      /* ... */\n    }, configurable: true, enumerable: false }\n});\n```\n\nD cuts that to:\n\n```javascript\nvar d = require('d');\n\nvar Account = function () {};\nObject.defineProperties(Account.prototype, {\n  deposit: d(function () {\n    /* ... */\n  }),\n  withdraw: d(function () {\n    /* ... */\n  }),\n  balance: d.gs(function () {\n    /* ... */\n  })\n});\n```\n\nBy default, created descriptor follow characteristics of native ES5 properties, and defines values as:\n\n```javascript\n{ configurable: true, enumerable: false, writable: true }\n```\n\nYou can overwrite it by preceding _value_ argument with instruction:\n```javascript\nd('c', value); // { configurable: true, enumerable: false, writable: false }\nd('ce', value); // { configurable: true, enumerable: true, writable: false }\nd('e', value); // { configurable: false, enumerable: true, writable: false }\n\n// Same way for get/set:\nd.gs('e', value); // { configurable: false, enumerable: true }\n```\n\n### Installation\n\n\t$ npm install d\n\t\nTo port it to Browser or any other (non CJS) environment, use your favorite CJS bundler. No favorite yet? Try: [Browserify](http://browserify.org/), [Webmake](https://github.com/medikoo/modules-webmake) or [Webpack](http://webpack.github.io/)\n\n### Other utilities\n\n#### autoBind(obj, props) _(d/auto-bind)_\n\nDefine methods which will be automatically bound to its instances\n\n```javascript\nvar d = require('d');\nvar autoBind = require('d/auto-bind');\n\nvar Foo = function () { this._count = 0; };\nObject.defineProperties(Foo.prototype, autoBind({\n  increment: d(function () { ++this._count; });\n}));\n\nvar foo = new Foo();\n\n// Increment foo counter on each domEl click\ndomEl.addEventListener('click', foo.increment, false);\n```\n\n#### lazy(obj, props) _(d/lazy)_\n\nDefine lazy properties, which will be resolved on first access\n\n```javascript\nvar d = require('d');\nvar lazy = require('d/lazy');\n\nvar Foo = function () {};\nObject.defineProperties(Foo.prototype, lazy({\n  items: d(function () { return []; })\n}));\n\nvar foo = new Foo();\nfoo.items.push(1, 2); // foo.items array created and defined directly on foo\n```\n\n## Tests [![Build Status](https://travis-ci.org/medikoo/d.png)](https://travis-ci.org/medikoo/d)\n\n\t$ npm test\n","repository":{"type":"git","url":"git://github.com/medikoo/d.git"},"users":{"julien-f":true,"goldenboy":true,"program247365":true,"estrattonbailey":true,"antixrist":true},"bugs":{"url":"https://github.com/medikoo/d/issues"},"license":"MIT","versions":{"0.1.0":{"name":"d","version":"0.1.0","description":"Property descriptor factory","main":"index.js","scripts":{"test":"node node_modules/tad/bin/tad"},"repository":{"type":"git","url":"git://github.com/medikoo/d.git"},"keywords":["descriptor","es","ecmascript","ecma","property","descriptors","meta","properties"],"dependencies":{"es5-ext":"~0.9.2"},"devDependencies":{"tad":"~0.1.16"},"author":{"name":"Mariusz Nowak","email":"medikoo+d@medikoo.com","url":"http://www.medikoo.com/"},"license":"MIT","bugs":{"url":"https://github.com/medikoo/d/issues"},"_id":"d@0.1.0","dist":{"shasum":"2dfac58b2a6c152361e933ed4c7f59115ff353e6","tarball":"http://nexus.dui88.com:8081/nexus/content/repositories/npm-registry/d/-/d-0.1.0.tgz"},"_from":".","_npmVersion":"1.2.32","_npmUser":{"name":"medikoo","email":"medikoo+npm@medikoo.com"},"maintainers":[{"name":"medikoo","email":"medikoo+npm@medikoo.com"}],"directories":{}},"0.1.1":{"name":"d","version":"0.1.1","description":"Property descriptor factory","author":{"name":"Mariusz Nowak","email":"medyk@medikoo.com","url":"http://www.medikoo.com/"},"scripts":{"test":"node node_modules/tad/bin/tad"},"repository":{"type":"git","url":"git://github.com/medikoo/d.git"},"keywords":["descriptor","es","ecmascript","ecma","property","descriptors","meta","properties"],"dependencies":{"es5-ext":"~0.10.2"},"devDependencies":{"tad":"~0.1.21"},"license":"MIT","bugs":{"url":"https://github.com/medikoo/d/issues"},"homepage":"https://github.com/medikoo/d","_id":"d@0.1.1","dist":{"shasum":"da184c535d18d8ee7ba2aa229b914009fae11309","tarball":"http://nexus.dui88.com:8081/nexus/content/repositories/npm-registry/d/-/d-0.1.1.tgz"},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"medikoo","email":"medikoo+npm@medikoo.com"},"maintainers":[{"name":"medikoo","email":"medikoo+npm@medikoo.com"}],"directories":{}},"1.0.0":{"name":"d","version":"1.0.0","description":"Property descriptor factory","author":{"name":"Mariusz Nowak","email":"medyk@medikoo.com","url":"http://www.medikoo.com/"},"keywords":["descriptor","es","ecmascript","ecma","property","descriptors","meta","properties"],"repository":{"type":"git","url":"git://github.com/medikoo/d.git"},"dependencies":{"es5-ext":"^0.10.9"},"devDependencies":{"tad":"^0.2.4","xlint":"^0.2.2","xlint-jslint-medikoo":"^0.1.4"},"scripts":{"lint":"node node_modules/xlint/bin/xlint --linter=node_modules/xlint-jslint-medikoo/index.js --no-cache --no-stream","lint-console":"node node_modules/xlint/bin/xlint --linter=node_modules/xlint-jslint-medikoo/index.js --watch","test":"node node_modules/tad/bin/tad"},"license":"MIT","gitHead":"f9031455a5012c23bb85a3eec93007df302b3a64","bugs":{"url":"https://github.com/medikoo/d/issues"},"homepage":"https://github.com/medikoo/d#readme","_id":"d@1.0.0","_shasum":"754bb5bfe55451da69a58b94d45f4c5b0462d58f","_from":".","_npmVersion":"2.14.7","_nodeVersion":"4.2.3","_npmUser":{"name":"medikoo","email":"medikoo+npm@medikoo.com"},"dist":{"shasum":"754bb5bfe55451da69a58b94d45f4c5b0462d58f","tarball":"http://nexus.dui88.com:8081/nexus/content/repositories/npm-registry/d/-/d-1.0.0.tgz"},"maintainers":[{"name":"medikoo","email":"medikoo+npm@medikoo.com"}],"directories":{}}},"name":"d","time":{"modified":"2016-10-27T13:45:00.542Z","created":"2013-06-20T11:13:43.686Z","0.1.0":"2013-06-20T11:13:46.851Z","0.1.1":"2014-04-24T15:41:11.066Z","1.0.0":"2015-12-04T11:39:09.506Z"},"readmeFilename":"README.md","homepage":"https://github.com/medikoo/d#readme"}