blob: 181c46eb61345f0a8a7b6f75bcecfa0930c2ea85 [file] [log] [blame]
function once(fun) {
var called = false;
return function (...args) {
/* istanbul ignore if */
if (called) {
// this is a smoke test and should never actually happen
throw new Error('once called more than once');
} else {
called = true;
fun.apply(this, args);
}
};
}
export default once;