New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

it-parallel-batch

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

it-parallel-batch - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

.nyc_output/4c1dfab3-3cbf-4a8a-9257-e37ecaa46e0d.json

4

index.js

@@ -6,3 +6,5 @@ 'use strict'

async function * parallelBatch (source, size) {
if (isNaN(size)) {
size = parseInt(size)
if (isNaN(size) || size < 1) {
size = 1

@@ -9,0 +11,0 @@ }

{
"name": "it-parallel-batch",
"version": "1.0.1",
"version": "1.0.2",
"description": "Takes an async iterator that emits promise-returning functions, invokes them in parallel and emits the results in the same order as the input",
"main": "index.js",
"repository": "github:achingbrain/it",
"homepage": "https://github.com/achingbrain/it#readme",
"bugs": "https://github.com/achingbrain/it/issues",
"scripts": {
"test": "nyc --check-coverage --lines 100 --reporter html --reporter lcov ava",
"test": "ava",
"lint": "standard",
"coveralls": "npm test && cat ./coverage/lcov.info | coveralls"
"coverage": "nyc --reporter html --reporter lcov ava",
"clean": "rm -rf .nyc_output coverage"
},
"author": "Alex Potsides <alex@achingbrain.net>",
"license": "ISC",
"repository": {
"type": "git",
"url": "git+https://github.com/achingbrain/it-parallel-batch.git"
},
"bugs": {
"url": "https://github.com/achingbrain/it-parallel-batch/issues"
},
"homepage": "https://github.com/achingbrain/it-parallel-batch#readme",
"devDependencies": {
"ava": "^2.4.0",
"coveralls": "^3.0.2",
"delay": "^4.3.0",
"it-all": "1.0.0",
"it-all": "^1.0.1",
"nyc": "^14.0.0",

@@ -31,3 +26,4 @@ "standard": "^14.3.1"

"it-batch": "0.0.1"
}
},
"gitHead": "92319e3234c9361cee162c3e4ff5648770028f2a"
}
# it-parallel-batch
[![Build status](https://travis-ci.org/achingbrain/it-parallel-batch.svg?branch=master)](https://travis-ci.org/achingbrain/it-parallel-batch?branch=master) [![Coverage Status](https://coveralls.io/repos/github/achingbrain/it-parallel-batch/badge.svg?branch=master)](https://coveralls.io/github/achingbrain/it-parallel-batch?branch=master) [![Dependencies Status](https://david-dm.org/achingbrain/it-parallel-batch/status.svg)](https://david-dm.org/achingbrain/it-parallel-batch)
[![Build status](https://travis-ci.org/achingbrain/it.svg?branch=master)](https://travis-ci.org/achingbrain/it?branch=master) [![Coverage Status](https://coveralls.io/repos/github/achingbrain/it/badge.svg?branch=master)](https://coveralls.io/github/achingbrain/it?branch=master) [![Dependencies Status](https://david-dm.org/achingbrain/it/status.svg)](https://david-dm.org/achingbrain/it)

@@ -5,0 +5,0 @@ > Takes an async iterator that emits promise-returning functions, invokes them in parallel and emits the results as they become available but in the same order as the input

@@ -135,1 +135,77 @@ 'use strict'

})
test('Should batch up entries with negative batch size', async (t) => {
const input = [
async () => {
await delay(200)
return 1
},
async () => {
await delay(100)
return 2
}
]
const batchSize = -1
const res = await all(parallelBatch(input, batchSize))
t.deepEqual(res, [1, 2])
})
test('Should batch up entries with zero batch size', async (t) => {
const input = [
async () => {
await delay(200)
return 1
},
async () => {
await delay(100)
return 2
}
]
const batchSize = 0
const res = await all(parallelBatch(input, batchSize))
t.deepEqual(res, [1, 2])
})
test('Should batch up entries with string batch size', async (t) => {
const input = [
async () => {
await delay(200)
return 1
},
async () => {
await delay(100)
return 2
}
]
const batchSize = '2'
const res = await all(parallelBatch(input, batchSize))
t.deepEqual(res, [1, 2])
})
test('Should batch up entries with non-integer batch size', async (t) => {
const input = [
async () => {
await delay(200)
return 1
},
async () => {
await delay(100)
return 2
}
]
const batchSize = 2.5
const res = await all(parallelBatch(input, batchSize))
t.deepEqual(res, [1, 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