once
sync once helper
Install
$ yarn add @zcong/once
Example
import Once from '@zcong/once'
class Test {}
// f only be called for the first time
const f = async () => new Test()
for (const _ of Array(10)) {
const test: Test = once.syncOnce<Test>('test', mockFn)
// test is Test instance which is f() returned.
}
License
MIT © zcong1993