1.0.2 • Published 9 months ago

once-noop v1.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
9 months ago

once-noop

A noop function that can only be called once. Usage:

const onceNoop = require('once-noop')
onceNoop.doNothing() // does absolutely nothing except set itself to a function that throws an error the next time
onceNoop.doNothing() // throws an error

If you want to create new noop functions that can only be called once, require the factory

const onceNoopFactory = require('once-noop/factory')
const myNoopInstance = onceNoopFactory()
const myOtherNoopInstance = onceNoopFactory()

myNoopInstance.doNothing() // does nothing
myOtherNoopInstance.doNothing() // does nothing
myOtherNoopInstance.doNothing() // throw error because called twice
1.0.2

9 months ago

1.0.1

10 months ago

1.0.0

10 months ago