@zcong/once
TypeScript icon, indicating that this package has built-in type declarations

0.2.1 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i @zcong/once

Weekly Downloads

44

Version

0.2.1

License

MIT

Unpacked Size

7.56 kB

Total Files

11

Last publish

Collaborators

  • zcong