We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Restrict a function to be used only once.
Alternatives: restrict, restrictOnce, restrictBefore, restrictAfter.
function restrictOnce(x) // x: a function
const xasyncfn = require('extra-async-function'); var count = 0; var fn = xasyncfn.restrictOnce(x => ++count); for (var i=0; i<10; ++i) fn(i); count; // → 1