Ensure a function is only called once
When called multiple times it will return the return value from the first call.
Unlike the module once, this one isn't naughty extending
$ npm install --save onetime
let i = 0;const foo = ;; //=> 0; //=> 0; //=> 0
const foo = ;;;//=> Error: Function `foo` can only be called once
Returns a function that only calls
Function that should only be called once.
Throw an error when called more than once.
MIT © Sindre Sorhus