Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
MR414N-ID
GitHub Repository: MR414N-ID/botku2
Path: blob/master/node_modules/@hapi/hoek/lib/once.js
1126 views
1
'use strict';
2
3
const internals = {
4
wrapped: Symbol('wrapped')
5
};
6
7
8
module.exports = function (method) {
9
10
if (method[internals.wrapped]) {
11
return method;
12
}
13
14
let once = false;
15
const wrappedFn = function (...args) {
16
17
if (!once) {
18
once = true;
19
method(...args);
20
}
21
};
22
23
wrappedFn[internals.wrapped] = true;
24
return wrappedFn;
25
};
26
27