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