mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-25 09:55:15 +00:00
24 lines
345 B
JavaScript
24 lines
345 B
JavaScript
|
'use strict';
|
||
|
|
||
|
const internals = {};
|
||
|
|
||
|
|
||
|
module.exports = function (method) {
|
||
|
|
||
|
if (method._hoekOnce) {
|
||
|
return method;
|
||
|
}
|
||
|
|
||
|
let once = false;
|
||
|
const wrapped = function (...args) {
|
||
|
|
||
|
if (!once) {
|
||
|
once = true;
|
||
|
method(...args);
|
||
|
}
|
||
|
};
|
||
|
|
||
|
wrapped._hoekOnce = true;
|
||
|
return wrapped;
|
||
|
};
|