{ "_args": [ [ { "raw": "onetime@^2.0.0", "scope": null, "escapedName": "onetime", "name": "onetime", "rawSpec": "^2.0.0", "spec": ">=2.0.0 <3.0.0", "type": "range" }, "/Volumes/2009-SSD/GT2/GT2-iOS/node_modules/restore-cursor" ] ], "_from": "onetime@>=2.0.0 <3.0.0", "_id": "onetime@2.0.1", "_inCache": true, "_location": "/onetime", "_nodeVersion": "4.7.3", "_npmOperationalInternal": { "host": "packages-12-west.internal.npmjs.com", "tmp": "tmp/onetime-2.0.1.tgz_1489980257371_0.244376125279814" }, "_npmUser": { "name": "sindresorhus", "email": "sindresorhus@gmail.com" }, "_npmVersion": "2.15.11", "_phantomChildren": {}, "_requested": { "raw": "onetime@^2.0.0", "scope": null, "escapedName": "onetime", "name": "onetime", "rawSpec": "^2.0.0", "spec": ">=2.0.0 <3.0.0", "type": "range" }, "_requiredBy": [ "/restore-cursor" ], "_resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", "_shasum": "067428230fd67443b2794b22bba528b6867962d4", "_shrinkwrap": null, "_spec": "onetime@^2.0.0", "_where": "/Volumes/2009-SSD/GT2/GT2-iOS/node_modules/restore-cursor", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", "url": "sindresorhus.com" }, "bugs": { "url": "https://github.com/sindresorhus/onetime/issues" }, "dependencies": { "mimic-fn": "^1.0.0" }, "description": "Ensure a function is only called once", "devDependencies": { "ava": "*", "xo": "*" }, "directories": {}, "dist": { "shasum": "067428230fd67443b2794b22bba528b6867962d4", "tarball": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz" }, "engines": { "node": ">=4" }, "files": [ "index.js" ], "gitHead": "32bca382f5934c8fe7fd78bcef9ad16b3474948f", "homepage": "https://github.com/sindresorhus/onetime#readme", "keywords": [ "once", "function", "one", "onetime", "func", "fn", "single", "call", "called", "prevent" ], "license": "MIT", "maintainers": [ { "name": "sindresorhus", "email": "sindresorhus@gmail.com" } ], "name": "onetime", "optionalDependencies": {}, "readme": "# onetime [![Build Status](https://travis-ci.org/sindresorhus/onetime.svg?branch=master)](https://travis-ci.org/sindresorhus/onetime)\n\n> Ensure a function is only called 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```\n$ npm install --save onetime\n```\n\n\n## Usage\n\n```js\nlet i = 0;\n\nconst foo = onetime(() => i++);\n\nfoo(); //=> 0\nfoo(); //=> 0\nfoo(); //=> 0\n```\n\n```js\nconst foo = onetime(() => {}, {throw: true});\n\nfoo();\n\nfoo();\n//=> Error: Function `foo` can only be called once\n```\n\n\n## API\n\n### onetime(fn, [options])\n\nReturns a function that only calls `fn` once.\n\n#### fn\n\nType: `Function`\n\nFunction that should only be called once.\n\n#### options\n\nType: `Object`\n\n##### throw\n\nType: `boolean`
\nDefault: `false`\n\nThrow an error when called more than once.\n\n\n## License\n\nMIT © [Sindre Sorhus](https://sindresorhus.com)\n", "readmeFilename": "readme.md", "repository": { "type": "git", "url": "git+https://github.com/sindresorhus/onetime.git" }, "scripts": { "test": "xo && ava" }, "version": "2.0.1" }