just-once
TypeScript icon, indicating that this package has built-in type declarations

2.2.0 • Public • Published

just-once

Part of a library of zero-dependency npm modules that do just do one thing. Guilt-free utilities for every occasion.

🍦 Try it

npm install just-once
yarn add just-once

Create a function that can only be invoked once

import once from 'just-once';

const fn = once(() => console.log('hello'));

fn();
// logs 'hello'
fn();
// does nothing

Dependents (7)

Package Sidebar

Install

npm i just-once

Weekly Downloads

10,607

Version

2.2.0

License

MIT

Unpacked Size

4.16 kB

Total Files

9

Last publish

Collaborators

  • angus-c