Socket
Socket
Sign inDemoInstall

fastq

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fastq - npm Package Compare versions

Comparing version 1.8.0 to 1.9.0

2

index.d.ts

@@ -7,2 +7,3 @@ declare function fastq<C, T = any, R = any>(context: C, worker: fastq.worker<C, T, R>, concurrency: number): fastq.queue<T, R>

type done<R = any> = (err: Error | null, result?: R) => void
type errorHandler<T = any> = (err: Error, task: T) => void

@@ -19,2 +20,3 @@ interface queue<T = any, R = any> {

killAndDrain(): any
error(handler: errorHandler): void
concurrency: number

@@ -21,0 +23,0 @@ drain(): any

8

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

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

"snazzy": "^8.0.0",
"standard": "^14.0.0",
"tape": "^4.13.2",
"typescript": "^3.8.3"
"standard": "^15.0.0",
"tape": "^5.0.0",
"typescript": "^4.0.2"
},

@@ -45,0 +45,0 @@ "dependencies": {

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

var _running = 0
var errorHandler = null

@@ -33,3 +34,4 @@ var self = {

kill: kill,
killAndDrain: killAndDrain
killAndDrain: killAndDrain,
error: error
}

@@ -91,2 +93,3 @@

current.callback = done || noop
current.errorHandler = errorHandler

@@ -167,2 +170,6 @@ if (_running === self.concurrency || self.paused) {

}
function error (handler) {
errorHandler = handler
}
}

@@ -178,2 +185,3 @@

this.context = null
this.errorHandler = null

@@ -184,4 +192,9 @@ var self = this

var callback = self.callback
var errorHandler = self.errorHandler
var val = self.value
self.value = null
self.callback = noop
if (self.errorHandler) {
errorHandler(err, val)
}
callback.call(self.context, err, result)

@@ -188,0 +201,0 @@ self.release(self)

@@ -83,2 +83,3 @@ # fastq

* <a href="#killAndDrain"><code>queue#<b>killAndDrain()</b></code></a>
* <a href="#error"><code>queue#<b>error()</b></code></a>
* <a href="#concurrency"><code>queue#<b>concurrency</b></code></a>

@@ -163,2 +164,9 @@ * <a href="#drain"><code>queue#<b>drain</b></code></a>

-------------------------------------------------------
<a name="error"></a>
### queue.error(handler)
Set a global error handler. `handler(err, task)` will be called
when any of the tasks return an error.
-------------------------------------------------------
<a name="concurrency"></a>

@@ -165,0 +173,0 @@ ### queue.concurrency

@@ -539,1 +539,17 @@ 'use strict'

})
test('push with worker throwing error', function (t) {
t.plan(5)
var q = buildQueue(function (task, cb) {
cb(new Error('test error'), null)
}, 1)
q.error(function (err, task) {
t.ok(err instanceof Error, 'global error handler should catch the error')
t.match(err.message, /test error/, 'error message should be "test error"')
t.equal(task, 42, 'The task executed should be passed')
})
q.push(42, function (err) {
t.ok(err instanceof Error, 'push callback should catch the error')
t.match(err.message, /test error/, 'error message should be "test error"')
})
})

@@ -6,3 +6,3 @@ {

"noEmit": true,
"strict": true,
"strict": true
},

@@ -12,2 +12,2 @@ "files": [

]
}
}

Sorry, the diff of this file is not supported yet

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