You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
parttimejob/node_modules/@hapi/hoek/lib/once.js

26 lines
401 B

'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;
};