Socket
Socket
Sign inDemoInstall

fastq

Package Overview
Dependencies
1
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.11.1 to 1.12.0

2

package.json
{
"name": "fastq",
"version": "1.11.1",
"version": "1.12.0",
"description": "Fast, in memory work queue",

@@ -5,0 +5,0 @@ "main": "queue.js",

@@ -230,3 +230,3 @@ 'use strict'

function push (value) {
return new Promise(function (resolve, reject) {
var p = new Promise(function (resolve, reject) {
pushCb(value, function (err, result) {

@@ -240,6 +240,13 @@ if (err) {

})
// Let's fork the promise chain to
// make the error bubble up to the user but
// not lead to a unhandledRejection
p.catch(noop)
return p
}
function unshift (value) {
return new Promise(function (resolve, reject) {
var p = new Promise(function (resolve, reject) {
unshiftCb(value, function (err, result) {

@@ -253,2 +260,9 @@ if (err) {

})
// Let's fork the promise chain to
// make the error bubble up to the user but
// not lead to a unhandledRejection
p.catch(noop)
return p
}

@@ -255,0 +269,0 @@ }

@@ -281,11 +281,15 @@ # fastq

Add a task at the end of the queue. The returned `Promise` will be fulfilled
when the task is processed.
Add a task at the end of the queue. The returned `Promise` will be fulfilled (rejected)
when the task is completed successfully (unsuccessfully).
This promise could be ignored as it will not lead to a `'unhandledRejection'`.
<a name="unshiftPromise"></a>
#### queue.unshift(task) => Promise
Add a task at the beginning of the queue. The returned `Promise` will be fulfilled
when the task is processed.
Add a task at the beginning of the queue. The returned `Promise` will be fulfilled (rejected)
when the task is completed successfully (unsuccessfully).
This promise could be ignored as it will not lead to a `'unhandledRejection'`.
## License

@@ -292,0 +296,0 @@

@@ -7,2 +7,3 @@ 'use strict'

const sleep = promisify(setTimeout)
const immediate = promisify(setImmediate)

@@ -122,1 +123,31 @@ test('concurrency', function (t) {

})
test('no unhandledRejection (push)', async function (t) {
function handleRejection () {
t.fail('unhandledRejection')
}
process.once('unhandledRejection', handleRejection)
const q = buildQueue(async function (task, cb) {
throw new Error('test error')
}, 1)
q.push(42)
await immediate()
process.removeListener('unhandledRejection', handleRejection)
})
test('no unhandledRejection (unshift)', async function (t) {
function handleRejection () {
t.fail('unhandledRejection')
}
process.once('unhandledRejection', handleRejection)
const q = buildQueue(async function (task, cb) {
throw new Error('test error')
}, 1)
q.unshift(42)
await immediate()
process.removeListener('unhandledRejection', handleRejection)
})

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc