Détail du package

once-noop

87f-18MIT1.0.2

A noop function that can only be run once

once, noop, jacob-zuma, noop2

readme

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