blob: db82e410f57aff35562868de9cf310263b1e2742 [file] [log] [blame]
import getArguments from './argsarray';
function once(fun) {
var called = false;
return getArguments(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;