Sha256: de93493e46efc8b2ce5e3bda8b9756389d1f93f1dd404e7b2627d132996e2c27
Contents?: true
Size: 1.98 KB
Versions: 62
Compression:
Stored size: 1.98 KB
Contents
{ "name": "onetime", "version": "1.0.0", "description": "Only call a function once. Unlike the module `once`, this one isn't naughty extending `Function.prototype`.", "keywords": [ "once", "one", "single", "call", "function", "prevent" ], "license": "MIT", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", "url": "http://sindresorhus.com" }, "files": [ "index.js" ], "repository": { "type": "git", "url": "git+https://github.com/sindresorhus/onetime.git" }, "scripts": { "test": "mocha" }, "devDependencies": { "mocha": "*" }, "engines": { "node": ">=0.10.0" }, "readme": "# onetime [](https://travis-ci.org/sindresorhus/onetime)\n\n> Only call a function once\n\nWhen called multiple times it will return the return value from the first call.\n\n*Unlike the module [once](https://github.com/isaacs/once), this one isn't naughty extending `Function.prototype`.*\n\n\n## Install\n\n```sh\n$ npm install --save onetime\n```\n\n\n## Usage\n\n```js\nvar i = 0;\n\nvar foo = onetime(function () {\n\treturn i++;\n});\n\nfoo(); //=> 0\nfoo(); //=> 0\nfoo(); //=> 0\n```\n\n\n## API\n\n### onetime(function, [shouldThrow])\n\n#### function\n\nType: `function`\n\nFunction that should only be called once.\n\n#### shouldThrow\n\nType: `boolean` \nDefault: `false`\n\n\n\nSet to `true` if you want it to fail with a nice and descriptive error when called more than once.\n\n\n## License\n\nMIT © [Sindre Sorhus](http://sindresorhus.com)\n", "readmeFilename": "readme.md", "bugs": { "url": "https://github.com/sindresorhus/onetime/issues" }, "homepage": "https://github.com/sindresorhus/onetime#readme", "_id": "onetime@1.0.0", "_shasum": "3a08a8e39d7816df52d34886374fb8ed8b651f62", "_resolved": "https://registry.npmjs.org/onetime/-/onetime-1.0.0.tgz", "_from": "onetime@>=1.0.0 <2.0.0" }
Version data entries
62 entries across 62 versions & 1 rubygems