Launch Week Day 5: Introducing Reachability for PHP.Learn More
Socket
Book a DemoSign in
Socket

it-parallel-batch

Package Overview
Dependencies
Maintainers
1
Versions
27
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
3.0.3
to
3.0.4
+40
-0
dist/src/index.d.ts
/**
* @packageDocumentation
*
* Takes an async iterator that emits promise-returning functions, invokes them in parallel and emits the results in the same order as the input.
*
* The final batch may be smaller than the batch size.
*
* @example
*
* ```javascript
* import parallelBatch from 'it-parallel-batch'
* import all from 'it-all'
* import delay from 'delay'
*
* // This can also be an iterator, async iterator, generator, etc
* const input = [
* async () => {
* await delay(500)
*
* return 1
* },
* async () => {
* await delay(200)
*
* return 2
* },
* async () => {
* await delay(100)
*
* return 3
* }
* ]
*
* const batchSize = 2
*
* const result = await all(parallelBatch(input, batchSize))
*
* console.info(result) // [1, 2, 3]
* ```
*/
/**
* Takes an (async) iterator that emits promise-returning functions,

@@ -3,0 +43,0 @@ * invokes them in parallel and emits the results as they become available but

+1
-1

@@ -1,1 +0,1 @@

{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAYA;;;;GAIG;AACH,wBAAgC,aAAa,CAAE,CAAC,EAAG,MAAM,EAAE,aAAa,CAAC,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,GAAE,MAAU,GAAG,cAAc,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,CAiB7K"}
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAcH;;;;GAIG;AACH,wBAAgC,aAAa,CAAE,CAAC,EAAG,MAAM,EAAE,aAAa,CAAC,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,GAAE,MAAU,GAAG,cAAc,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,CAiB7K"}

@@ -0,1 +1,41 @@

/**
* @packageDocumentation
*
* Takes an async iterator that emits promise-returning functions, invokes them in parallel and emits the results in the same order as the input.
*
* The final batch may be smaller than the batch size.
*
* @example
*
* ```javascript
* import parallelBatch from 'it-parallel-batch'
* import all from 'it-all'
* import delay from 'delay'
*
* // This can also be an iterator, async iterator, generator, etc
* const input = [
* async () => {
* await delay(500)
*
* return 1
* },
* async () => {
* await delay(200)
*
* return 2
* },
* async () => {
* await delay(100)
*
* return 3
* }
* ]
*
* const batchSize = 2
*
* const result = await all(parallelBatch(input, batchSize))
*
* console.info(result) // [1, 2, 3]
* ```
*/
import batch from 'it-batch';

@@ -2,0 +42,0 @@ /**

@@ -1,1 +0,1 @@

{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,UAAU,CAAA;AAY5B;;;;GAIG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,SAAU,CAAC,CAAC,aAAa,CAAM,MAAoE,EAAE,OAAe,CAAC;IACvI,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE;QAC7C,MAAM,MAAM,GAAyC,KAAK,CAAC,GAAG,CAC5D,KAAK,EAAE,CAAmB,EAAE,EAAE;YAC5B,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,CAAA;QAC9E,CAAC,CAAC,CAAA;QAEJ,KAAK,IAAI,CAA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AAA;aACjB;SACF;KACF;AACH,CAAC"}
{
"name": "it-parallel-batch",
"version": "3.0.3",
"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",
"version": "3.0.4",
"description": "Process (async)iterable values as functions with concurrency control",
"author": "Alex Potsides <alex@achingbrain.net>",

@@ -32,2 +32,3 @@ "license": "Apache-2.0 OR MIT",

"parserOptions": {
"project": true,
"sourceType": "module"

@@ -138,3 +139,3 @@ }

"devDependencies": {
"aegir": "^40.0.11",
"aegir": "^41.1.9",
"delay": "^6.0.0",

@@ -141,0 +142,0 @@ "it-all": "^3.0.0"

+20
-26

@@ -1,33 +0,13 @@

# it-parallel-batch <!-- omit in toc -->
[![codecov](https://img.shields.io/codecov/c/github/achingbrain/it.svg?style=flat-square)](https://codecov.io/gh/achingbrain/it)
[![CI](https://img.shields.io/github/actions/workflow/status/achingbrain/it/js-test-and-release.yml?branch=master\&style=flat-square)](https://github.com/achingbrain/it/actions/workflows/js-test-and-release.yml?query=branch%3Amaster)
> Takes an async iterator that emits promise-returning functions, invokes them in parallel and emits the results in the same order as the input
> Process (async)iterable values as functions with concurrency control
## Table of contents <!-- omit in toc -->
# About
- [Install](#install)
- [Browser `<script>` tag](#browser-script-tag)
- [Usage](#usage)
- [License](#license)
- [Contribution](#contribution)
Takes an async iterator that emits promise-returning functions, invokes them in parallel and emits the results in the same order as the input.
## Install
```console
$ npm i it-parallel-batch
```
### Browser `<script>` tag
Loading this module through a script tag will make it's exports available as `ItParallelBatch` in the global namespace.
```html
<script src="https://unpkg.com/it-parallel-batch/dist/index.min.js"></script>
```
The final batch may be smaller than the batch size.
## Usage
## Example

@@ -65,4 +45,18 @@ ```javascript

## License
# Install
```console
$ npm i it-parallel-batch
```
## Browser `<script>` tag
Loading this module through a script tag will make it's exports available as `ItParallelBatch` in the global namespace.
```html
<script src="https://unpkg.com/it-parallel-batch/dist/index.min.js"></script>
```
# License
Licensed under either of

@@ -73,4 +67,4 @@

## Contribution
# Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

@@ -0,1 +1,42 @@

/**
* @packageDocumentation
*
* Takes an async iterator that emits promise-returning functions, invokes them in parallel and emits the results in the same order as the input.
*
* The final batch may be smaller than the batch size.
*
* @example
*
* ```javascript
* import parallelBatch from 'it-parallel-batch'
* import all from 'it-all'
* import delay from 'delay'
*
* // This can also be an iterator, async iterator, generator, etc
* const input = [
* async () => {
* await delay(500)
*
* return 1
* },
* async () => {
* await delay(200)
*
* return 2
* },
* async () => {
* await delay(100)
*
* return 3
* }
* ]
*
* const batchSize = 2
*
* const result = await all(parallelBatch(input, batchSize))
*
* console.info(result) // [1, 2, 3]
* ```
*/
import batch from 'it-batch'

@@ -2,0 +43,0 @@