Big update!Introducing GitHub Bot Commands. Learn more
Socket
Log inBook a demo

async-once

Package Overview
Dependencies
2
Maintainers
2
Versions
3
Issues
File Explorer

Advanced tools

async-once

Guarantee a node-style async function is only executed once.

    2.0.0latest

Version published
Maintainers
2
Weekly downloads
25
decreased by-16.67%

Weekly downloads

Changelog

Source

2.0.0 (2022-06-28)

⚠ BREAKING CHANGES

  • Normalize repository, dropping node <10.13 support (#10)

Miscellaneous Chores

  • Normalize repository, dropping node <10.13 support (#10) (7bcae07)

Readme

Source

async-once

NPM version Downloads Build Status Coveralls Status

Guarantee a node-style async function is only executed once.

Usage

var once = require('async-once'); var count = 0; var myAsyncFunc = once(function (cb) { count++; cb(null, count); }); myAsyncFunc(function (err, result) { assert(result === 1); }); myAsyncFunc(function (err, result) { assert(result === 1); }); assert(count === 1);

API

once(fn)

Takes a node-style async function (fn) to ensure it's only called once. The function should accept a callback as its last parameter which is called with cb(err, result). Returns a function that can be called any number of times but will only execute once. Arguments passed to the returned function will be passed to the fn.

License

MIT

Keywords

FAQs

What is async-once?

Guarantee a node-style async function is only executed once.

Is async-once popular?

The npm package async-once receives a total of 23 weekly downloads. As such, async-once popularity was classified as not popular.

Is async-once well maintained?

We found that async-once demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.It has 2 open source maintainers collaborating on the project.

Last updated on 28 Jun 2022

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket

Product

Subscribe to our newsletter

Get open source security insights delivered straight into your inbox. Be the first to learn about new features and product updates.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc