first commit
This commit is contained in:
commit
eb2f504652
32490 changed files with 5731109 additions and 0 deletions
25
node_modules/@hapi/hoek/lib/once.js
generated
vendored
Executable file
25
node_modules/@hapi/hoek/lib/once.js
generated
vendored
Executable file
|
|
@ -0,0 +1,25 @@
|
|||
'use strict';
|
||||
|
||||
const internals = {
|
||||
wrapped: Symbol('wrapped')
|
||||
};
|
||||
|
||||
|
||||
module.exports = function (method) {
|
||||
|
||||
if (method[internals.wrapped]) {
|
||||
return method;
|
||||
}
|
||||
|
||||
let once = false;
|
||||
const wrappedFn = function (...args) {
|
||||
|
||||
if (!once) {
|
||||
once = true;
|
||||
method(...args);
|
||||
}
|
||||
};
|
||||
|
||||
wrappedFn[internals.wrapped] = true;
|
||||
return wrappedFn;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue