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

ts-async-iterable-queue

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ts-async-iterable-queue

A queue structure implementing AsyncIterableIterator<T>

  • 3.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
282
decreased by-29.15%
Maintainers
1
Weekly downloads
 
Created
Source

ts-async-iterable-queue

A queue structure implementing AsyncIterableIterator<T>

npm version Build Status

Usage

import { createAsyncQueue } from 'ts-async-iterable-queue'

const q = createAsyncQueue<number>();

const postToQueue= async () => {
    for (let x = 0; x < 100; ++x) {
        await delay(1)
        q.enqueue(x)
    }
    q.complete();
}

const receiveFromQueue= async () => {
    let i = 0;
    for await (const ii of q) {
        if(i++ !== ii){
            throw Error()
        }
    }
    if(ii !== 100){
        throw Error()
    }
    console.log("queue completed!")
}

postToQueue()       // fire-and-forget
receiveFromQueue()  // fire-and-forget

acknowledgements

Created using the wonderful https://github.com/alexjoverm/typescript-library-starter.

FAQs

Package last updated on 20 Apr 2019

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