Upakovka v Electron.JS no po staroy sborke cherez .cjs
This commit is contained in:
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;
|
||||
|
||||
Reference in New Issue
Block a user