{"_id":"decko","_rev":"13-e684e426965de31e2d8f79a50e4fde65","name":"decko","description":"A collection of the most useful property decorators.","dist-tags":{"latest":"1.2.0"},"versions":{"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":"developit","email":"jason@developit.ca"},"maintainers":[{"name":"developit","email":"jason@developit.ca"}],"dist":{"shasum":"5500a152ebcb4f1055c3bd4c052fb042c920fe9b","tarball":"https://registry.npmjs.org/decko/-/decko-1.0.0.tgz","integrity":"sha512-9yBFmIUnVuOFALPHh4kPiNufObXYV0EeQpwCeHFKEsJYGGwmHieI0Z4dO4X8g41yx8Bmvmo+sHjO00SsEgqW7w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCTlRz8dLyW4kJyNNwA79TuF1BVjLVseqpQ8XKYyFJcnAIgSx9cA5HYfZTacPpVVEV7FqLVXjvqyeEAqpIvEv9nt4g="}]}},"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":"developit","email":"jason@developit.ca"},"maintainers":[{"name":"developit","email":"jason@developit.ca"}],"dist":{"shasum":"7731c44870dbea40e333a33e694c9cec6d4125d7","tarball":"https://registry.npmjs.org/decko/-/decko-1.1.0.tgz","integrity":"sha512-VKyw/FzFQBYGM40eAMWH2s4LJS8QeY1RlYQKvGpiOaT1EfDh82XrAY/t6tZax+sXVqi8EvtJwWkbTD27jANiBA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFyoUFEi9UMNZLkI1cVrt2xx/F/u541bV8trokLnw+aZAiAHhUxtuXXUKZFA1bp3D7b0PXr7svBsGZ7JrE0w8rI0Lw=="}]}},"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":"developit","email":"jason@developit.ca"},"maintainers":[{"name":"developit","email":"jason@developit.ca"}],"dist":{"shasum":"ce3d72168420579f8277a2e5dd1927cf1ba75be8","tarball":"https://registry.npmjs.org/decko/-/decko-1.1.1.tgz","integrity":"sha512-onDFjM8osM/7K/cx+B7e6+eRw2R38HJHSxVVkNThJQ1R5WDB29fycSxC3ydyyqS9tufvTXSmMpzhKlj0M51Cxg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBSZATWtc3hJLw64PO6zVklb6STvnaSIouVI20GNLJ29AiAknXpyXDvFfdZQO847DoaRNwFatbEpxqMkzQDELckqIQ=="}]}},"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":"developit","email":"jason@developit.ca"},"maintainers":[{"name":"developit","email":"jason@developit.ca"}],"dist":{"shasum":"806bad6a0ed1eb7375cedb31c58af624571c5b78","tarball":"https://registry.npmjs.org/decko/-/decko-1.1.2.tgz","integrity":"sha512-KeNbtFVg2JWRNGDs5yOySJ4CE7P0hGC67t0pQKx0zQZvSA2fErdH2N2Bp1KqzBQb5yotAOuNaiOkMAUC1b12zA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC/3o+R1nlQ4VrbmixMz0IEhZqDAMoV5uXceDKreMr23AIhAIUq+b7EfZ/7I/II658QvMRidutw/aN7M43sd5cWnkz/"}]}},"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":"developit","email":"jason@developit.ca"},"maintainers":[{"name":"developit","email":"jason@developit.ca"}],"dist":{"shasum":"b0406160d775d586b0d25888838ccd99b59e6261","tarball":"https://registry.npmjs.org/decko/-/decko-1.1.3.tgz","integrity":"sha512-8D9vfQH2C/OGO7YDK1TE5RSgK7ztAoryasbI0cm1cyjvbeNbO9My1QSlXr2jZfOrXl8MKjKiE8V+tmFowTc41w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC2isEXk0OiTOlqDwS5d8NiWTm/s1EfAc4g/1zwTaR6EQIhAMcLfmmJk2TU08GyJ/NdYbHc7AwxzhJT3GJ1wJz766Mq"}]}},"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":"developit","email":"jason@developit.ca"},"maintainers":[{"name":"developit","email":"jason@developit.ca"}],"dist":{"shasum":"fd43c735e967b8013306884a56fbe665996b6817","tarball":"https://registry.npmjs.org/decko/-/decko-1.2.0.tgz","integrity":"sha512-m8FnyHXV1QX+S1cl+KPFDIl6NMkxtKsy6+U/aYyjrOqWMuwAwYWu7ePqrsUHtDR5Y8Yk2pi/KIDSgF+vT4cPOQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDqPEPVtot5r83GMwb2vpLccOXE3HiW18joM7+VJg5uJwIgIc9hfKwcMjw6DfRScPYTwQIzKD9RELp95Y/7rDwK9F4="}]},"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/decko-1.2.0.tgz_1488215970285_0.3722242400981486"}}},"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\n","maintainers":[{"name":"developit","email":"jason@developit.ca"}],"time":{"modified":"2022-06-14T22:28:08.037Z","created":"2015-08-24T01:32:51.132Z","1.0.0":"2015-08-24T01:32:51.132Z","1.1.0":"2015-09-05T16:11:03.676Z","1.1.1":"2015-10-31T17:09:53.405Z","1.1.2":"2015-11-18T17:16:31.073Z","1.1.3":"2015-12-15T15:18:50.994Z","1.2.0":"2017-02-27T17:19:32.241Z"},"homepage":"https://github.com/developit/decko#readme","repository":{"type":"git","url":"git://github.com/developit/decko.git"},"bugs":{"url":"https://github.com/developit/decko/issues"},"readmeFilename":"README.md","users":{"developit":true,"ta2edchimp":true,"drewigg":true}}