0.2.1 • Published 4 years ago

@zcong/once v0.2.1

Weekly downloads
56
License
MIT
Repository
-
Last release
4 years ago

once

NPM version NPM downloads CircleCI codecov typedoc

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