{"versions":{"1.2.0":{"name":"decko","version":"1.2.0","main":"dist/decko.js","types":"dist/decko.d.ts","description":"A collection of the most useful property decorators.","scripts":{"build":"mkdir -p dist && babel -f src/decko.js -s -o $npm_package_main < src/decko.js && npm run build:ts","build:ts":"cp src/decko.d.ts dist/","test":"npm run test:ts && eslint {src,tests}/**.js && mocha --compilers js:babel/register tests/**/*.js","test:ts":"tsc -p ./","style:ts":"tsfmt -r","prepublish":"npm run build","release":"npm run build && git commit -am $npm_package_version && git tag $npm_package_version && git push && git push --tags && npm publish"},"files":["src","dist"],"repository":{"type":"git","url":"git://github.com/developit/decko.git"},"devDependencies":{"babel":"^5.8.21","babel-eslint":"^4.1.6","chai":"^3.2.0","eslint":"^1.10.3","mocha":"^2.3.0","typescript":"2.1.6","typescript-formatter":"4.1.1"},"gitHead":"d6d369553450f899dc6f076f5a97be451587dafd","bugs":{"url":"https://github.com/developit/decko/issues"},"homepage":"https://github.com/developit/decko#readme","_id":"decko@1.2.0","_shasum":"fd43c735e967b8013306884a56fbe665996b6817","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.9.4","_npmUser":{"name":"anonymous","email":"jason@developit.ca"},"maintainers":[{"name":"anonymous","email":"jason@developit.ca"}],"dist":{"shasum":"fd43c735e967b8013306884a56fbe665996b6817","size":6671,"noattachment":false,"tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/decko/-/decko-1.2.0.tgz","integrity":"sha512-m8FnyHXV1QX+S1cl+KPFDIl6NMkxtKsy6+U/aYyjrOqWMuwAwYWu7ePqrsUHtDR5Y8Yk2pi/KIDSgF+vT4cPOQ=="},"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/decko-1.2.0.tgz_1488215970285_0.3722242400981486"},"directories":{},"publish_time":1488215972241,"_hasShrinkwrap":false,"_cnpm_publish_time":1488215972241,"_cnpmcore_publish_time":"2021-12-16T16:54:40.018Z","contributors":[]},"1.1.3":{"name":"decko","version":"1.1.3","main":"decko.js","description":"A collection of the most useful property decorators.","scripts":{"build":"babel -f $npm_package_main -s -o $npm_package_main < src/${npm_package_main}","test":"eslint {src,tests}/**.js && mocha --compilers js:babel/register tests/**/*.js","prepublish":"npm run build","release":"npm run build && git commit -am $npm_package_version && git tag $npm_package_version && git push && git push --tags && npm publish"},"repository":{"type":"git","url":"git://github.com/developit/decko.git"},"devDependencies":{"babel":"^5.8.21","babel-eslint":"^4.1.6","chai":"^3.2.0","eslint":"^1.10.3","mocha":"^2.3.0"},"gitHead":"1c7b97dddbb2dbacddb0d6133534646dedab4708","bugs":{"url":"https://github.com/developit/decko/issues"},"homepage":"https://github.com/developit/decko#readme","_id":"decko@1.1.3","_shasum":"b0406160d775d586b0d25888838ccd99b59e6261","_from":".","_npmVersion":"2.14.7","_nodeVersion":"4.2.2","_npmUser":{"name":"anonymous","email":"jason@developit.ca"},"maintainers":[{"name":"anonymous","email":"jason@developit.ca"}],"dist":{"shasum":"b0406160d775d586b0d25888838ccd99b59e6261","size":7013,"noattachment":false,"tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/decko/-/decko-1.1.3.tgz","integrity":"sha512-8D9vfQH2C/OGO7YDK1TE5RSgK7ztAoryasbI0cm1cyjvbeNbO9My1QSlXr2jZfOrXl8MKjKiE8V+tmFowTc41w=="},"directories":{},"publish_time":1450192730994,"_hasShrinkwrap":false,"_cnpm_publish_time":1450192730994,"_cnpmcore_publish_time":"2021-12-16T16:54:40.296Z","contributors":[]},"1.1.2":{"name":"decko","version":"1.1.2","main":"decko.js","description":"A collection of the most useful property decorators.","scripts":{"build":"babel -f $npm_package_main -s -o $npm_package_main < src/${npm_package_main}","test":"jshint src/**.js && mocha --compilers js:babel/register tests/**/*.js","prepublish":"npm run build","release":"npm run build && git commit -am $npm_package_version && git tag $npm_package_version && git push && git push --tags && npm publish"},"repository":{"type":"git","url":"git://github.com/developit/decko.git"},"devDependencies":{"babel":"^5.8.21","chai":"^3.2.0","jshint":"^2.8.0","mocha":"^2.3.0"},"gitHead":"22777f4726aa4f98ff57e6dd6a34f254c6094b66","bugs":{"url":"https://github.com/developit/decko/issues"},"homepage":"https://github.com/developit/decko#readme","_id":"decko@1.1.2","_shasum":"806bad6a0ed1eb7375cedb31c58af624571c5b78","_from":".","_npmVersion":"2.14.7","_nodeVersion":"4.2.2","_npmUser":{"name":"anonymous","email":"jason@developit.ca"},"maintainers":[{"name":"anonymous","email":"jason@developit.ca"}],"dist":{"shasum":"806bad6a0ed1eb7375cedb31c58af624571c5b78","size":6335,"noattachment":false,"tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/decko/-/decko-1.1.2.tgz","integrity":"sha512-KeNbtFVg2JWRNGDs5yOySJ4CE7P0hGC67t0pQKx0zQZvSA2fErdH2N2Bp1KqzBQb5yotAOuNaiOkMAUC1b12zA=="},"directories":{},"publish_time":1447866991073,"_hasShrinkwrap":false,"_cnpm_publish_time":1447866991073,"_cnpmcore_publish_time":"2021-12-16T16:54:40.534Z","contributors":[]},"1.1.1":{"name":"decko","version":"1.1.1","main":"decko.js","description":"A collection of the most useful property decorators.","scripts":{"build":"babel -f $npm_package_main -s -o $npm_package_main < src/${npm_package_main}","test":"jshint src/**.js && mocha --compilers js:babel/register tests/**/*.js","prepublish":"npm run build","release":"npm run build && git commit -am $npm_package_version && git tag $npm_package_version && git push && git push --tags && npm publish"},"repository":{"type":"git","url":"git://github.com/developit/decko.git"},"devDependencies":{"babel":"^5.8.21","chai":"^3.2.0","jshint":"^2.8.0","mocha":"^2.3.0"},"gitHead":"6b7785bcd9a3d420439795a0013307b560bf14e8","bugs":{"url":"https://github.com/developit/decko/issues"},"homepage":"https://github.com/developit/decko#readme","_id":"decko@1.1.1","_shasum":"ce3d72168420579f8277a2e5dd1927cf1ba75be8","_from":".","_npmVersion":"2.11.3","_nodeVersion":"0.12.7","_npmUser":{"name":"anonymous","email":"jason@developit.ca"},"maintainers":[{"name":"anonymous","email":"jason@developit.ca"}],"dist":{"shasum":"ce3d72168420579f8277a2e5dd1927cf1ba75be8","size":5294,"noattachment":false,"tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/decko/-/decko-1.1.1.tgz","integrity":"sha512-onDFjM8osM/7K/cx+B7e6+eRw2R38HJHSxVVkNThJQ1R5WDB29fycSxC3ydyyqS9tufvTXSmMpzhKlj0M51Cxg=="},"directories":{},"publish_time":1446311393405,"_hasShrinkwrap":false,"_cnpm_publish_time":1446311393405,"_cnpmcore_publish_time":"2021-12-16T16:54:40.734Z","contributors":[]},"1.1.0":{"name":"decko","version":"1.1.0","main":"decko.js","description":"A collection of the most useful property decorators.","scripts":{"build":"babel src --source-root src -s -d .","test":"jshint src/**.js && mocha --compilers js:babel/register tests/**/*.js","prepublish":"npm run build","release":"npm run build && git commit -am $npm_package_version && git tag $npm_package_version && git push && git push --tags && npm publish"},"repository":{"type":"git","url":"git://github.com/developit/decko.git"},"devDependencies":{"babel":"^5.8.21","chai":"^3.2.0","jshint":"^2.8.0","mocha":"^2.3.0"},"gitHead":"e596d489b2d2742ab3d4a9b01cdf29da0c8bcef8","bugs":{"url":"https://github.com/developit/decko/issues"},"homepage":"https://github.com/developit/decko#readme","_id":"decko@1.1.0","_shasum":"7731c44870dbea40e333a33e694c9cec6d4125d7","_from":".","_npmVersion":"2.11.3","_nodeVersion":"0.12.7","_npmUser":{"name":"anonymous","email":"jason@developit.ca"},"maintainers":[{"name":"anonymous","email":"jason@developit.ca"}],"dist":{"shasum":"7731c44870dbea40e333a33e694c9cec6d4125d7","size":5295,"noattachment":false,"tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/decko/-/decko-1.1.0.tgz","integrity":"sha512-VKyw/FzFQBYGM40eAMWH2s4LJS8QeY1RlYQKvGpiOaT1EfDh82XrAY/t6tZax+sXVqi8EvtJwWkbTD27jANiBA=="},"directories":{},"publish_time":1441469463676,"_hasShrinkwrap":false,"_cnpm_publish_time":1441469463676,"_cnpmcore_publish_time":"2021-12-16T16:54:40.992Z","contributors":[]},"1.0.0":{"name":"decko","version":"1.0.0","main":"decko.js","description":"A collection of the most useful property decorators.","scripts":{"build":"babel src --source-root src -s -d .","test":"jshint src/**.js","prepublish":"npm run build","release":"npm run build && git commit -am $npm_package_version && git tag $npm_package_version && git push && git push --tags && npm publish"},"repository":{"type":"git","url":"git://github.com/developit/decko.git"},"devDependencies":{"babel":"^5.8.21","jshint":"^2.8.0"},"gitHead":"20763c7f5ec0ad7736b5c157be23157b2b70fe8d","bugs":{"url":"https://github.com/developit/decko/issues"},"homepage":"https://github.com/developit/decko#readme","_id":"decko@1.0.0","_shasum":"5500a152ebcb4f1055c3bd4c052fb042c920fe9b","_from":".","_npmVersion":"2.11.3","_nodeVersion":"0.12.7","_npmUser":{"name":"anonymous","email":"jason@developit.ca"},"maintainers":[{"name":"anonymous","email":"jason@developit.ca"}],"dist":{"shasum":"5500a152ebcb4f1055c3bd4c052fb042c920fe9b","size":4448,"noattachment":false,"tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/decko/-/decko-1.0.0.tgz","integrity":"sha512-9yBFmIUnVuOFALPHh4kPiNufObXYV0EeQpwCeHFKEsJYGGwmHieI0Z4dO4X8g41yx8Bmvmo+sHjO00SsEgqW7w=="},"directories":{},"publish_time":1440379971132,"_hasShrinkwrap":false,"_cnpm_publish_time":1440379971132,"_cnpmcore_publish_time":"2021-12-16T16:54:41.200Z","contributors":[]}},"dist-tags":{"latest":"1.2.0"},"name":"decko","time":{"created":"2022-01-26T21:21:27.358Z","modified":"2023-08-02T16:42:41.616Z","1.2.0":"2017-02-27T17:19:32.241Z","1.1.3":"2015-12-15T15:18:50.994Z","1.1.2":"2015-11-18T17:16:31.073Z","1.1.1":"2015-10-31T17:09:53.405Z","1.1.0":"2015-09-05T16:11:03.676Z","1.0.0":"2015-08-24T01:32:51.132Z"},"readme":"# decko [![NPM Version](https://img.shields.io/npm/v/decko.svg?style=flat)](https://npmjs.com/package/decko) [![Build Status](https://travis-ci.org/developit/decko.svg?branch=master)](https://travis-ci.org/developit/decko)\n\nA concise implementation of the three most useful [decorators](https://github.com/wycats/javascript-decorators):\n\n- `@bind`: make the value of `this` constant within a method\n- `@debounce`: throttle calls to a method\n- `@memoize`: cache return values based on arguments\n\nDecorators help simplify code by replacing the noise of common patterns with declarative annotations.\nConversely, decorators can also be overused and create obscurity.\nDecko establishes 3 standard decorators that are immediately recognizable, so you can avoid creating decorators in your own codebase.\n\n> ???? **Tip:** decko is particularly well-suited to [**Preact Classful Components**](https://github.com/developit/preact).\n>\n> ???? **Note:**\n> - For Babel 6+, be sure to install [babel-plugin-transform-decorators-legacy](https://github.com/loganfsmyth/babel-plugin-transform-decorators-legacy).\n> - For Typescript, be sure to enable `{\"experimentalDecorators\": true}` in your tsconfig.json.\n\n\n## Installation\n\nAvailable on [npm](https://npmjs.com/package/decko):\n\n```sh\nnpm i -S decko\n```\n\n\n## Usage\n\nEach decorator method is available as a named import.\n\n```js\nimport { bind, memoize, debounce } from 'decko';\n```\n\n\n### `@bind`\n\n```js\nclass Example {\n\t@bind\n\tfoo() {\n\t\t// the value of `this` is always the object from which foo() was referenced.\n\t\treturn this;\n\t}\n}\n\nlet e = new Example();\nassert.equal(e.foo.call(null), e);\n```\n\n\n\n### `@memoize`\n\n> Cache values returned from the decorated function.\n> Uses the first argument as a cache key.\n> _Cache keys are always converted to strings._\n>\n> ##### Options:\n>\n> `caseSensitive: false` - _Makes cache keys case-insensitive_\n>\n> `cache: {}` - _Presupply cache storage, for seeding or sharing entries_\n\n```js\nclass Example {\n\t@memoize\n\texpensive(key) {\n\t\tlet start = Date.now();\n\t\twhile (Date.now()-start < 500) key++;\n\t\treturn key;\n\t}\n}\n\nlet e = new Example();\n\n// this takes 500ms\nlet one = e.expensive(1);\n\n// this takes 0ms\nlet two = e.expensive(1);\n\n// this takes 500ms\nlet three = e.expensive(2);\n```\n\n\n\n### `@debounce`\n\n> Throttle calls to the decorated function. To debounce means \"call this at most once per N ms\".\n> All outward function calls get collated into a single inward call, and only the latest (most recent) arguments as passed on to the debounced function.\n>\n> ##### Options:\n>\n> `delay: 0` - _The number of milliseconds to buffer calls for._\n\n```js\nclass Example {\n\t@debounce\n\tfoo() {\n\t\treturn this;\n\t}\n}\n\nlet e = new Example();\n\n// this will only call foo() once:\nfor (let i=1000; i--) e.foo();\n```\n\n\n---\n\nLicense\n-------\n\nMIT","users":{}}