Ensure a function is only called once. Forked from sindresorhus/onetime, with native TypeScript support.