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

ueue

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ueue

Queue - ueue is silent. Simple event-driven queue manager.

latest
Source
npmnpm
Version
1.0.2
Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

Queue - ueue is silent

npm versionnode versionBuild status - Linux/OSXBuild status - WindowsCodecov

Event-driven queue manager.

Features

Install

Install via yarn:

yarn add ueue

Install via npm:

npm i ueue

Docs

Read the docs on GitHub pages.

Example

Import

CommonJS

const { Q, } = require('ueue');

ES6

import { Q, } from 'ueue';

Use

Create queue

const q = new Q();

Enqueue things

Consider following script:

const sleep = function (ms) {
	return new Promise(res => {
		setTimeout(() => res(), ms);
	});
};

q
	.add(() => 'Test 1')
	.then(console.log);

q
	.add(async () => (await sleep(1000), 'Test 2'))
	.then(console.log);

q.addBunch(
	async () => (await sleep(100), '1'),
	async () => (await sleep(100), '2')
).then(console.log);

q.addBunch(
	async () => (await sleep(100), '1'),
	async () => {
		await sleep(100);
		throw '2';
	},
	async () => (await sleep(100), '3')
).catch(console.log);

console.log('Test 0');

And following output:

Test 0
Test 1
Test 2
[ { result: '1' }, { result: '2' } ]
[ { result: '1' }, { error: '2' }, { result: '3' } ]

Keywords

queue

FAQs

Package last updated on 17 Aug 2020

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