Upakovka v Electron.JS no po staroy sborke cherez .cjs
This commit is contained in:
41
node_modules/onetime/index.d.ts
generated
vendored
41
node_modules/onetime/index.d.ts
generated
vendored
@@ -1,26 +1,28 @@
|
||||
export type Options = {
|
||||
/**
|
||||
Throw an error when called more than once.
|
||||
declare namespace onetime {
|
||||
interface Options {
|
||||
/**
|
||||
Throw an error when called more than once.
|
||||
|
||||
@default false
|
||||
*/
|
||||
readonly throw?: boolean;
|
||||
};
|
||||
@default false
|
||||
*/
|
||||
throw?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
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 - The function that should only be called once.
|
||||
@param fn - Function that should only be called once.
|
||||
@returns A function that only calls `fn` once.
|
||||
|
||||
@example
|
||||
```
|
||||
import onetime from 'onetime';
|
||||
import onetime = require('onetime');
|
||||
|
||||
let index = 0;
|
||||
let i = 0;
|
||||
|
||||
const foo = onetime(() => ++index);
|
||||
const foo = onetime(() => ++i);
|
||||
|
||||
foo(); //=> 1
|
||||
foo(); //=> 1
|
||||
@@ -30,19 +32,19 @@ declare const onetime: {
|
||||
```
|
||||
*/
|
||||
<ArgumentsType extends unknown[], ReturnType>(
|
||||
fn: (...arguments_: ArgumentsType) => ReturnType,
|
||||
options?: Options
|
||||
): (...arguments_: ArgumentsType) => ReturnType;
|
||||
fn: (...arguments: ArgumentsType) => ReturnType,
|
||||
options?: onetime.Options
|
||||
): (...arguments: ArgumentsType) => ReturnType;
|
||||
|
||||
/**
|
||||
Get the number of times `fn` has been called.
|
||||
|
||||
@param fn - The function to get call count from.
|
||||
@param fn - Function to get call count from.
|
||||
@returns A number representing how many times `fn` has been called.
|
||||
|
||||
@example
|
||||
```
|
||||
import onetime from 'onetime';
|
||||
import onetime = require('onetime');
|
||||
|
||||
const foo = onetime(() => {});
|
||||
foo();
|
||||
@@ -53,7 +55,10 @@ declare const onetime: {
|
||||
//=> 3
|
||||
```
|
||||
*/
|
||||
callCount(fn: (...arguments_: any[]) => unknown): number;
|
||||
callCount(fn: (...arguments: any[]) => unknown): number;
|
||||
|
||||
// TODO: Remove this for the next major release
|
||||
default: typeof onetime;
|
||||
};
|
||||
|
||||
export default onetime;
|
||||
export = onetime;
|
||||
|
||||
15
node_modules/onetime/index.js
generated
vendored
15
node_modules/onetime/index.js
generated
vendored
@@ -1,4 +1,5 @@
|
||||
import mimicFunction from 'mimic-function';
|
||||
'use strict';
|
||||
const mimicFn = require('mimic-fn');
|
||||
|
||||
const calledFunctions = new WeakMap();
|
||||
|
||||
@@ -16,7 +17,7 @@ const onetime = (function_, options = {}) => {
|
||||
|
||||
if (callCount === 1) {
|
||||
returnValue = function_.apply(this, arguments_);
|
||||
function_ = undefined;
|
||||
function_ = null;
|
||||
} else if (options.throw === true) {
|
||||
throw new Error(`Function \`${functionName}\` can only be called once`);
|
||||
}
|
||||
@@ -24,18 +25,20 @@ const onetime = (function_, options = {}) => {
|
||||
return returnValue;
|
||||
};
|
||||
|
||||
mimicFunction(onetime, function_);
|
||||
mimicFn(onetime, function_);
|
||||
calledFunctions.set(onetime, callCount);
|
||||
|
||||
return onetime;
|
||||
};
|
||||
|
||||
onetime.callCount = function_ => {
|
||||
module.exports = onetime;
|
||||
// TODO: Remove this for the next major release
|
||||
module.exports.default = onetime;
|
||||
|
||||
module.exports.callCount = function_ => {
|
||||
if (!calledFunctions.has(function_)) {
|
||||
throw new Error(`The given function \`${function_.name}\` is not wrapped by the \`onetime\` package`);
|
||||
}
|
||||
|
||||
return calledFunctions.get(function_);
|
||||
};
|
||||
|
||||
export default onetime;
|
||||
|
||||
18
node_modules/onetime/package.json
generated
vendored
18
node_modules/onetime/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "onetime",
|
||||
"version": "7.0.0",
|
||||
"version": "5.1.2",
|
||||
"description": "Ensure a function is only called once",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/onetime",
|
||||
@@ -10,14 +10,8 @@
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"type": "module",
|
||||
"exports": {
|
||||
"types": "./index.d.ts",
|
||||
"default": "./index.js"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
"node": ">=6"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
@@ -39,11 +33,11 @@
|
||||
"prevent"
|
||||
],
|
||||
"dependencies": {
|
||||
"mimic-function": "^5.0.0"
|
||||
"mimic-fn": "^2.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^5.3.1",
|
||||
"tsd": "^0.29.0",
|
||||
"xo": "^0.56.0"
|
||||
"ava": "^1.4.1",
|
||||
"tsd": "^0.7.1",
|
||||
"xo": "^0.24.0"
|
||||
}
|
||||
}
|
||||
|
||||
26
node_modules/onetime/readme.md
generated
vendored
26
node_modules/onetime/readme.md
generated
vendored
@@ -1,4 +1,4 @@
|
||||
# onetime
|
||||
# onetime [](https://travis-ci.com/github/sindresorhus/onetime)
|
||||
|
||||
> Ensure a function is only called once
|
||||
|
||||
@@ -8,18 +8,18 @@ When called multiple times it will return the return value from the first call.
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
npm install onetime
|
||||
```
|
||||
$ npm install onetime
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import onetime from 'onetime';
|
||||
const onetime = require('onetime');
|
||||
|
||||
let index = 0;
|
||||
let i = 0;
|
||||
|
||||
const foo = onetime(() => ++index);
|
||||
const foo = onetime(() => ++i);
|
||||
|
||||
foo(); //=> 1
|
||||
foo(); //=> 1
|
||||
@@ -29,7 +29,7 @@ onetime.callCount(foo); //=> 3
|
||||
```
|
||||
|
||||
```js
|
||||
import onetime from 'onetime';
|
||||
const onetime = require('onetime');
|
||||
|
||||
const foo = onetime(() => {}, {throw: true});
|
||||
|
||||
@@ -49,7 +49,7 @@ Returns a function that only calls `fn` once.
|
||||
|
||||
Type: `Function`
|
||||
|
||||
The function that should only be called once.
|
||||
Function that should only be called once.
|
||||
|
||||
#### options
|
||||
|
||||
@@ -69,7 +69,7 @@ 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
|
||||
import onetime from 'onetime';
|
||||
const onetime = require('onetime');
|
||||
|
||||
const foo = onetime(() => {});
|
||||
|
||||
@@ -85,4 +85,10 @@ console.log(onetime.callCount(foo));
|
||||
|
||||
Type: `Function`
|
||||
|
||||
The function to get call count from.
|
||||
Function to get call count from.
|
||||
|
||||
## onetime for enterprise
|
||||
|
||||
Available as part of the Tidelift Subscription.
|
||||
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user