13 lines
199 B
JavaScript
Raw Normal View History

2019-02-01 14:06:44 +01:00
'use strict';
module.exports = function once(fn) {
let called = false;
return function() {
if (called) {
return;
}
called = true;
return fn.apply(null, arguments);
};
};