diff options
author | Florian Dold <florian.dold@gmail.com> | 2019-03-27 21:01:33 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2019-03-27 21:01:33 +0100 |
commit | cc97a4dd2a967e1c2273bd5f4c5f49a5bf2e2585 (patch) | |
tree | 92c5d88706a6ffc654d1b133618d357890e7096b /node_modules/onetime/readme.md | |
parent | 3771b4d6b67b34c130f3a9a1a15f42deefdb2eda (diff) |
remove node_modules
Diffstat (limited to 'node_modules/onetime/readme.md')
-rw-r--r-- | node_modules/onetime/readme.md | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/node_modules/onetime/readme.md b/node_modules/onetime/readme.md deleted file mode 100644 index 95eb3b7c9..000000000 --- a/node_modules/onetime/readme.md +++ /dev/null @@ -1,65 +0,0 @@ -# onetime [](https://travis-ci.org/sindresorhus/onetime) - -> Ensure a function is only called once - -When called multiple times it will return the return value from the first call. - -*Unlike the module [once](https://github.com/isaacs/once), this one isn't naughty extending `Function.prototype`.* - - -## Install - -``` -$ npm install --save onetime -``` - - -## Usage - -```js -let i = 0; - -const foo = onetime(() => i++); - -foo(); //=> 0 -foo(); //=> 0 -foo(); //=> 0 -``` - -```js -const foo = onetime(() => {}, {throw: true}); - -foo(); - -foo(); -//=> Error: Function `foo` can only be called once -``` - - -## API - -### onetime(fn, [options]) - -Returns a function that only calls `fn` once. - -#### fn - -Type: `Function` - -Function that should only be called once. - -#### options - -Type: `Object` - -##### throw - -Type: `boolean`<br> -Default: `false` - -Throw an error when called more than once. - - -## License - -MIT © [Sindre Sorhus](https://sindresorhus.com) |