1
0

run npm install to generate a package lock

This commit is contained in:
sashinexists
2024-12-07 13:18:31 +11:00
parent e7d08a91b5
commit 23437d228e
2501 changed files with 290663 additions and 0 deletions

10
node_modules/function-once/.editorconfig generated vendored Normal file
View File

@@ -0,0 +1,10 @@
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

2
node_modules/function-once/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
declare const once: <T>(fn: () => T) => () => T;
export default once;

14
node_modules/function-once/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,14 @@
/* MAIN */
const once = (fn) => {
let called = false;
let result;
return () => {
if (!called) {
called = true;
result = fn();
}
return result;
};
};
/* EXPORT */
export default once;

21
node_modules/function-once/license generated vendored Normal file
View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2021-present Fabio Spampinato
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

28
node_modules/function-once/package.json generated vendored Executable file
View File

@@ -0,0 +1,28 @@
{
"name": "function-once",
"repository": "github:fabiospampinato/function-once",
"description": "Wraps a function so that it's only ever executed once.",
"version": "3.0.0",
"type": "module",
"main": "dist/index.js",
"exports": "./dist/index.js",
"types": "./dist/index.d.ts",
"scripts": {
"clean": "tsex clean",
"compile": "tsex compile",
"compile:watch": "tsex compile --watch",
"test": "tsex test",
"test:watch": "tsex test --watch",
"prepublishOnly": "tsex prepare"
},
"keywords": [
"once",
"function",
"call"
],
"devDependencies": {
"fava": "^0.2.1",
"tsex": "^3.0.1",
"typescript": "^5.1.6"
}
}

26
node_modules/function-once/readme.md generated vendored Normal file
View File

@@ -0,0 +1,26 @@
# Function Once
Wraps a function so that it's only ever executed once.
Note: `this` is always set to `undefined` and only functions that don't accept any arguments are supported, as using those with a function that's only ever executed once is practically just a footgun. If you need different `this` or different arguments you should probably use memoization instead.
## Install
```sh
npm install --save function-once
```
## Usage
```ts
import once from 'function-once';
const rand = once (() => Math.random ());
rand (); // => 0.3344627371267874
rand (); // => 0.3344627371267874
```
## License
MIT © Fabio Spampinato

26
node_modules/function-once/src/index.ts generated vendored Executable file
View File

@@ -0,0 +1,26 @@
/* MAIN */
const once = <T> ( fn: (() => T) ): (() => T) => {
let called = false;
let result: T;
return (): T => {
if ( !called ) {
called = true;
result = fn ();
}
return result;
};
};
/* EXPORT */
export default once;

22
node_modules/function-once/test/index.js generated vendored Normal file
View File

@@ -0,0 +1,22 @@
/* IMPORT */
import {describe} from 'fava';
import once from '../dist/index.js';
/* MAIN */
describe ( 'Function Once', it => {
it ( 'works', t => {
const rand = once ( () => Math.random () );
const value = rand ();
t.is ( rand (), value );
t.is ( rand (), value );
t.is ( rand (), value );
});
});

3
node_modules/function-once/tsconfig.json generated vendored Executable file
View File

@@ -0,0 +1,3 @@
{
"extends": "tsex/tsconfig.json"
}