Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

queuefy

Package Overview
Dependencies
Maintainers
2
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

queuefy

Wrapper to make any async handler be like a single thread with queue

  • 1.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

queuefy

CI Maintainability Test Coverage npm (tag)

Wrapper to make any async handler act like a single thread with a queue.

Install

yarn add queuefy
npm i queuefy

Usage

import {queuefy} from 'queuefy'

let count = 0
const target = (param: number) => new Promise(resolve =>
  setTimeout(() => {
    count++
    resolve(count + param)
  }, Math.random() * 100),
)
const fn = queuefy(target)
const [r0, r1, r2, r3, r4] = await Promise.all([fn(4), fn(3), fn(2), fn(1), fn(0)])

// r0 is 5
// r1 is 5
// r2 is 5
// ... 

Alternatives

License

MIT

Keywords

FAQs

Package last updated on 21 Mar 2023

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc