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%2Findex.d.ts;h=ea84caba320c862cb25ae7b4808588bb27939314;hp=d39c42d961db4109a1bc71cd5c984761285d4b93;hb=4d07c77cf4d78cab8639e13ddc3c22495e585b0b;hpb=b3950616b54221c40a7dab9099bda675007e5b6e diff --git a/.config/coc/extensions/node_modules/coc-prettier/node_modules/onetime/index.d.ts b/.config/coc/extensions/node_modules/coc-prettier/node_modules/onetime/index.d.ts index d39c42d9..ea84caba 100644 --- a/.config/coc/extensions/node_modules/coc-prettier/node_modules/onetime/index.d.ts +++ b/.config/coc/extensions/node_modules/coc-prettier/node_modules/onetime/index.d.ts @@ -1,4 +1,4 @@ -declare namespace oneTime { +declare namespace onetime { interface Options { /** Throw an error when called more than once. @@ -9,16 +9,31 @@ declare namespace oneTime { } } -declare const oneTime: { +declare const onetime: { /** Ensure a function is only called once. When called multiple times it will return the return value from the first call. @param fn - Function that should only be called once. @returns A function that only calls `fn` once. + + @example + ``` + import onetime = require('onetime'); + + let i = 0; + + const foo = onetime(() => ++i); + + foo(); //=> 1 + foo(); //=> 1 + foo(); //=> 1 + + onetime.callCount(foo); //=> 3 + ``` */ ( fn: (...arguments: ArgumentsType) => ReturnType, - options?: oneTime.Options + options?: onetime.Options ): (...arguments: ArgumentsType) => ReturnType; /** @@ -43,7 +58,7 @@ declare const oneTime: { callCount(fn: (...arguments: any[]) => unknown): number; // TODO: Remove this for the next major release - default: typeof oneTime; + default: typeof onetime; }; -export = oneTime; +export = onetime;