{"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://registry-npm.ywwl.com/d/download/d-0.1.0.tgz","integrity":"sha512-q1k/CDdGj/pHoG/LU7B4tZvrGmeYqUscIS8oU/vbEn23hr4plDKJvUG0gAD5nqGb98czTCIfHqsn71FA/JK5bg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIF18KP4ZmtB5w7mmALp38dfl/AyaK3tmnfis95TN/UwUAiEAujsMQCtE2lULyKgyae7KmXSC/xwdRhL3FEdUNDXd5q8="}],"size":3070,"noattachment":false,"key":"/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":{},"readme":"[![Build status][build-image]][build-url]\n[![Tests coverage][cov-image]][cov-url]\n[![npm version][npm-image]][npm-url]\n\n# d\n\n## Property descriptor factory\n\n_Originally derived from [d](https://github.com/medikoo/d) package._\n\nDefining properties with descriptors is very verbose:\n\n```javascript\nvar Account = function () {};\nObject.defineProperties(Account.prototype, {\n  deposit: {\n    value: function () { /* ... */ },\n    configurable: true,\n    enumerable: false,\n    writable: true\n  },\n  withdraw: {\n    value: function () { /* ... */ },\n    configurable: true,\n    enumerable: false,\n    writable: true\n  },\n  balance: { get: function () { /* ... */ }, 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  withdraw: d(function () { /* ... */ }),\n  balance: d.gs(function () { /* ... */ })\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\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    $ npm install d\n\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({ items: d(function () { return []; }) }));\n\nvar foo = new Foo();\nfoo.items.push(1, 2); // foo.items array created and defined directly on foo\n```\n\n## Tests\n\n    $ npm test\n\n## Security contact information\n\nTo report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.\n\n---\n\n<div align=\"center\">\n\t<b>\n\t\t<a href=\"https://tidelift.com/subscription/pkg/npm-d?utm_source=npm-d&utm_medium=referral&utm_campaign=readme\">Get professional support for d with a Tidelift subscription</a>\n\t</b>\n\t<br>\n\t<sub>\n\t\tTidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.\n\t</sub>\n</div>\n\n[build-image]: https://github.com/medikoo/d/workflows/Integrate/badge.svg\n[build-url]: https://github.com/medikoo/d/actions?query=workflow%3AIntegrate\n[cov-image]: https://img.shields.io/codecov/c/github/medikoo/d.svg\n[cov-url]: https://codecov.io/gh/medikoo/d\n[npm-image]: https://img.shields.io/npm/v/d.svg\n[npm-url]: https://www.npmjs.com/package/d\n","publish_time":1371726826851,"_cnpm_publish_time":1371726826851,"dist-tags":{"latest":"1.0.2"}}