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

run-parallel

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

run-parallel - npm Package Compare versions

Comparing version 1.1.2 to 1.1.3

28

index.js

@@ -1,6 +0,5 @@

var dezalgo = require('dezalgo')
module.exports = function (tasks, cb) {
if (cb) cb = dezalgo(cb)
var results, pending, keys
var isSync = true
if (Array.isArray(tasks)) {

@@ -15,18 +14,25 @@ results = []

function done (i, err, result) {
results[i] = result
if (--pending === 0 || err) {
function done (err, results) {
function end () {
if (cb) cb(err, results)
cb = null
}
if (isSync) process.nextTick(end)
else end()
}
function each (i, err, result) {
results[i] = result
if (--pending === 0 || err) {
done(err, results)
}
}
if (!pending) {
// empty
if (cb) cb(null, results)
cb = null
done(null, results)
} else if (keys) {
// object
keys.forEach(function (key) {
tasks[key](done.bind(undefined, key))
tasks[key](each.bind(undefined, key))
})

@@ -36,5 +42,7 @@ } else {

tasks.forEach(function (task, i) {
task(done.bind(undefined, i))
task(each.bind(undefined, i))
})
}
isSync = false
}
{
"name": "run-parallel",
"description": "Run an array of functions in parallel",
"version": "1.1.2",
"version": "1.1.3",
"author": {

@@ -13,5 +13,3 @@ "name": "Feross Aboukhadijeh",

},
"dependencies": {
"dezalgo": "^1.0.1"
},
"dependencies": {},
"devDependencies": {

@@ -18,0 +16,0 @@ "standard": "^4.3.2",

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