New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

node-singleflight

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-singleflight

provides a duplicate function call suppression

latest
Source
npmnpm
Version
0.1.2
Version published
Maintainers
1
Created
Source

node-singleflight

provides a duplicate function call suppression

If a duplicate comes in, the duplicate caller waits for the original to complete and receives the same results.

Notice

argument func may need to set up timeout in some ways, otherwise it may create too many listeners and cause memory leak

Install

Yarn

yarn add node-singleflight

NPM

npm install node-singleflight --save

Usage

  • See do.test.js File
const singleflight = require('node-singleflight')

async function example() {
    let data = singleflight.Do('SomeKey', async () => {
        let data = await doSomething()
        let processed = processData(data)
        return processed
    })
    return data
}

Keywords

singleflight

FAQs

Package last updated on 21 May 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts