{"name":"d","version":"1.0.2","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+https://github.com/medikoo/d.git"},"dependencies":{"es5-ext":"^0.10.64","type":"^2.7.2"},"devDependencies":{"eslint":"^8.57.0","eslint-config-medikoo":"^4.2.0","git-list-updated":"^1.2.1","github-release-from-cc-changelog":"^2.3.0","husky":"^4.3.8","lint-staged":"~13.2.3","nyc":"^15.1.0","prettier-elastic":"^2.8.8","tad":"^3.1.1"},"husky":{"hooks":{"pre-commit":"lint-staged"}},"lint-staged":{"*.js":["eslint"],"*.{css,html,js,json,md,yaml,yml}":["prettier -c"]},"eslintConfig":{"extends":"medikoo/es5","root":true},"prettier":{"printWidth":100,"tabWidth":4,"overrides":[{"files":["*.md","*.yml"],"options":{"tabWidth":2}}]},"nyc":{"all":true,"exclude":[".github","coverage/**","test/**","*.config.js"],"reporter":["lcov","html","text-summary"]},"scripts":{"coverage":"nyc npm test","lint":"eslint --ignore-path=.gitignore .","lint:updated":"pipe-git-updated --base=main --ext=js -- eslint --ignore-pattern '!*'","prettier-check":"prettier -c --ignore-path .gitignore \"**/*.{css,html,js,json,md,yaml,yml}\"","prettier-check:updated":"pipe-git-updated --base=main --ext=css --ext=html --ext=js --ext=json --ext=md --ext=yaml --ext=yml -- prettier -c","prettify":"prettier --write --ignore-path .gitignore \"**/*.{css,html,js,json,md,yaml,yml}\"","prettify:updated":"pipe-git-updated ---base=main -ext=css --ext=html --ext=js --ext=json --ext=md --ext=yaml --ext=yml -- prettier --write","test":"tad"},"license":"ISC","engines":{"node":">=0.12"},"_id":"d@1.0.2","gitHead":"b11fe68c318dbb51b817a22a562175b29adf2e1f","bugs":{"url":"https://github.com/medikoo/d/issues"},"homepage":"https://github.com/medikoo/d#readme","_nodeVersion":"20.11.1","_npmVersion":"10.2.4","dist":{"integrity":"sha512-MOqHvMWF9/9MX6nza0KgvFH4HpMU0EF5uUDXqX/BtxtU8NfB0QzRtJ8Oe/6SuS4kbhyzVJwjd97EA4PKrzJ8bw==","shasum":"2aefd554b81981e7dccf72d6842ae725cb17e5de","tarball":"http://registry-npm.ywwl.com/d/download/d-1.0.2.tgz","fileCount":8,"unpackedSize":14209,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCYOMCQ/dxRHSHWD291ULKcsiS1FMRh0hMwHJ3DP5g9BQIgSPdOxJyioQF5JxUPBtq3XZomHAJ9OcxW7u0R3agAe74="}],"size":5001,"noattachment":false,"key":"/d/-/d-1.0.2.tgz"},"_npmUser":{"name":"medikoo","email":"medikoo+npm@medikoo.com"},"directories":{},"maintainers":[{"name":"medikoo","email":"medikoo+npm@medikoo.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/d_1.0.2_1709298487610_0.08298235986736358"},"_hasShrinkwrap":false,"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":1709298487744,"_cnpm_publish_time":1709298487744,"dist-tags":{"latest":"1.0.2"}}