X-Git-Url: https://git.josue.xyz/?p=dotfiles%2F.git;a=blobdiff_plain;f=.config%2Fcoc%2Fextensions%2Fnode_modules%2Fcoc-prettier%2Fnode_modules%2Fonetime%2Freadme.md;h=2d133d3a09c6c65b9186d4d88894b6c887ad7e1e;hp=9ecd1b24db12d7d47e43c0137b56fa8b6894173f;hb=4d07c77cf4d78cab8639e13ddc3c22495e585b0b;hpb=b3950616b54221c40a7dab9099bda675007e5b6e diff --git a/.config/coc/extensions/node_modules/coc-prettier/node_modules/onetime/readme.md b/.config/coc/extensions/node_modules/coc-prettier/node_modules/onetime/readme.md index 9ecd1b24..2d133d3a 100644 --- a/.config/coc/extensions/node_modules/coc-prettier/node_modules/onetime/readme.md +++ b/.config/coc/extensions/node_modules/coc-prettier/node_modules/onetime/readme.md @@ -1,4 +1,4 @@ -# onetime [![Build Status](https://travis-ci.org/sindresorhus/onetime.svg?branch=master)](https://travis-ci.org/sindresorhus/onetime) +# onetime [![Build Status](https://travis-ci.com/sindresorhus/onetime.svg?branch=master)](https://travis-ci.com/github/sindresorhus/onetime) > Ensure a function is only called once @@ -6,14 +6,12 @@ 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 and extending `Function.prototype`.* - ## Install ``` $ npm install onetime ``` - ## Usage ```js @@ -23,9 +21,9 @@ let i = 0; const foo = onetime(() => ++i); -foo(); //=> 0 -foo(); //=> 0 -foo(); //=> 0 +foo(); //=> 1 +foo(); //=> 1 +foo(); //=> 1 onetime.callCount(foo); //=> 3 ``` @@ -41,10 +39,9 @@ foo(); //=> Error: Function `foo` can only be called once ``` - ## API -### onetime(fn, [options]) +### onetime(fn, options?) Returns a function that only calls `fn` once. @@ -56,11 +53,11 @@ Function that should only be called once. #### options -Type: `Object` +Type: `object` ##### throw -Type: `boolean`
+Type: `boolean`\ Default: `false` Throw an error when called more than once. @@ -72,6 +69,8 @@ Returns a number representing how many times `fn` has been called. Note: It throws an error if you pass in a function that is not wrapped by `onetime`. ```js +const onetime = require('onetime'); + const foo = onetime(() => {}); foo(); @@ -88,7 +87,8 @@ Type: `Function` Function to get call count from. +## onetime for enterprise -## License +Available as part of the Tidelift Subscription. -MIT © [Sindre Sorhus](https://sindresorhus.com) +The maintainers of onetime and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-onetime?utm_source=npm-onetime&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)