first commit
This commit is contained in:
25
app_vue/node_modules/@hapi/hoek/lib/once.js
generated
vendored
Normal file
25
app_vue/node_modules/@hapi/hoek/lib/once.js
generated
vendored
Normal 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;
|
||||
};
|
Reference in New Issue
Block a user