ordered-queue
Advanced tools
+35
-35
@@ -1,44 +0,44 @@ | ||
| var TimeQueue = require('timequeue'); | ||
| var inherits = require('util').inherits; | ||
| var OrderedEmitter = require('ordered-emitter'); | ||
| 'use strict'; | ||
| const TimeQueue = require('timequeue'); | ||
| const OrderedEmitter = require('ordered-emitter'); | ||
| /** | ||
| * @constructor | ||
| * @extends {TimeQueue} | ||
| * @param {Function(arg1, arg2, ..., callback)} worker | ||
| * @param {!Object} options | ||
| */ | ||
| var OrderedQueue = module.exports = function OrderedQueue(worker, options) { | ||
| TimeQueue.call(this, worker, options); | ||
| var self = this; | ||
| this._oe = new OrderedEmitter(); | ||
| this._oe.on('push', function(data) { | ||
| TimeQueue.prototype.push.apply(self, data.args); | ||
| }); | ||
| }; | ||
| module.exports = class OrderedQueue extends TimeQueue { | ||
| /** | ||
| * @constructor | ||
| * @extends {TimeQueue} | ||
| * @param {Function(arg1, arg2, ..., callback)} worker | ||
| * @param {!Object} options | ||
| */ | ||
| constructor(worker, options) { | ||
| super(worker, options); | ||
| inherits(OrderedQueue, TimeQueue); | ||
| this._oe = new OrderedEmitter(); | ||
| this._oe.on('push', (data) => { | ||
| super.push.apply(this, data.args); | ||
| }); | ||
| } | ||
| /** | ||
| * @overwrite | ||
| * @param {Number} order | ||
| * @param {Object} arg... | ||
| * @param {!Function(!Error, arg1...)} callback | ||
| */ | ||
| OrderedQueue.prototype.push = function(order) { | ||
| this._oe.emit('push', { | ||
| order: order, | ||
| args: Array.prototype.slice.call(arguments, 1) | ||
| }); | ||
| }; | ||
| /** | ||
| * @overwrite | ||
| * @param {Number} order | ||
| * @param {Object} arg... | ||
| * @param {!Function(!Error, arg1...)} callback | ||
| */ | ||
| push(order) { | ||
| this._oe.emit('push', { | ||
| order, | ||
| args: Array.prototype.slice.call(arguments, 1), | ||
| }); | ||
| } | ||
| /** | ||
| * Resets order of queue. | ||
| */ | ||
| OrderedQueue.prototype.reset = function() { | ||
| this._oe.reset('push'); | ||
| /** | ||
| * Resets order of queue. | ||
| */ | ||
| reset() { | ||
| this._oe.reset('push'); | ||
| } | ||
| }; |
+6
-5
@@ -9,3 +9,3 @@ { | ||
| ], | ||
| "version": "1.0.1", | ||
| "version": "1.1.0", | ||
| "repository": { | ||
@@ -25,12 +25,13 @@ "type": "git", | ||
| "ordered-emitter": "~1.0.0", | ||
| "timequeue": "~1.0.0" | ||
| "timequeue": "~1.1.0" | ||
| }, | ||
| "devDependencies": { | ||
| "istanbul": "*", | ||
| "mocha": "*" | ||
| "istanbul": "^0.4.5", | ||
| "mocha": "^4.0.1", | ||
| "sinon": "^4.0.2" | ||
| }, | ||
| "engines": { | ||
| "node": ">=0.12" | ||
| "node": ">=4" | ||
| }, | ||
| "license": "MIT" | ||
| } |
+2
-2
@@ -12,4 +12,4 @@ # ordered-queue.js | ||
| ```js | ||
| var OrderedQueue = require('ordered-queue'); | ||
| var q = new OrderedQueue(function worker(str, callback) { | ||
| const OrderedQueue = require('ordered-queue'); | ||
| const q = new OrderedQueue((str, callback) => { | ||
| console.log(str); | ||
@@ -16,0 +16,0 @@ callback(); |
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
4122
-2.04%3
50%+ Added
- Removed
Updated