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

promise-parallel-throttle

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

promise-parallel-throttle - npm Package Compare versions

Comparing version 3.3.0 to 3.4.0

.github/workflows/main.yml

2

dist/lib/throttle.js

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

!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e=e||self).throttle={})}(this,function(e){"use strict";var n={maxInProgress:5,failFast:!1,nextCheck:function(e,n){return Promise.resolve(e.amountStarted<n.length)},ignoreIsFunctionCheck:!1};function t(e,t){return new Promise(function(o,s){var c=Object.assign({},n,t),f={amountDone:0,amountStarted:0,amountResolved:0,amountRejected:0,amountNextCheckFalsey:0,rejectedIndexes:[],resolvedIndexes:[],nextCheckFalseyIndexes:[],taskResults:[]};if(0===e.length)return o(f);for(var u=!1,a=0,i=function(){if(!0!==u){if(f.amountDone++,"function"==typeof c.progressCallback&&c.progressCallback(f),f.amountDone===e.length)return o(f);a<e.length&&r(a++)}},r=function(n){c.nextCheck(f,e).then(function(t){!0===t?function(n){if(f.amountStarted++,"function"==typeof e[n])e[n]().then(function(e){f.taskResults[n]=e,f.resolvedIndexes.push(n),f.amountResolved++,i()},function(e){if(f.taskResults[n]=e,f.rejectedIndexes.push(n),f.amountRejected++,!0===c.failFast)return u=!0,s(f);i()});else{if(!0!==c.ignoreIsFunctionCheck)return u=!0,s(new Error("tasks["+n+"]: "+e[n]+", is supposed to be of type function"));f.taskResults[n]=e[n],f.resolvedIndexes.push(n),f.amountResolved++,i()}}(n):(f.amountNextCheckFalsey++,f.nextCheckFalseyIndexes.push(n),i())},s)},h=0;h<Math.min(c.maxInProgress,e.length);h++)r(a++)})}function o(e,n){return new Promise(function(o,s){t(e,n).then(function(e){o(e.taskResults)},function(e){e instanceof Error?s(e):s(e.taskResults[e.rejectedIndexes[0]])})})}e.raw=t,e.sync=function(e,n){return o(e,Object.assign({},{maxInProgress:1,failFast:!0},n))},e.all=function(e,n){return o(e,Object.assign({},{failFast:!0},n))},Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).throttle={})}(this,(function(e){"use strict";var n={maxInProgress:5,failFast:!1,nextCheck:function(e,n){return Promise.resolve(e.amountStarted<n.length)},ignoreIsFunctionCheck:!1};function t(e,t){return new Promise((function(s,o){var u=Object.assign({},n,t),r={amountDone:0,amountStarted:0,amountResolved:0,amountRejected:0,amountNextCheckFalsey:0,rejectedIndexes:[],resolvedIndexes:[],nextCheckFalseyIndexes:[],taskResults:[]};if(0===e.length)return s(r);for(var a=!1,i=0,c=function(e,n){if(r.taskResults[n]=e,r.rejectedIndexes.push(n),r.amountRejected++,!0===u.failFast)return a=!0,o(r);f()},f=function(){if(!0!==a){if(r.amountDone++,"function"==typeof u.progressCallback&&u.progressCallback(r),r.amountDone===e.length)return s(r);i<e.length&&l(i++)}},l=function(n){u.nextCheck(r,e).then((function(t){!0===t?function(n){if(r.amountStarted++,"function"==typeof e[n])try{e[n]().then((function(e){r.taskResults[n]=e,r.resolvedIndexes.push(n),r.amountResolved++,f()}),(function(e){c(e,n)}))}catch(e){c(e,n)}else{if(!0!==u.ignoreIsFunctionCheck)return a=!0,o(new Error("tasks["+n+"]: "+e[n]+", is supposed to be of type function"));r.taskResults[n]=e[n],r.resolvedIndexes.push(n),r.amountResolved++,f()}}(n):(r.amountNextCheckFalsey++,r.nextCheckFalseyIndexes.push(n),f())}),o)},d=0;d<Math.min(u.maxInProgress,e.length);d++)l(i++)}))}function s(e,n){return new Promise((function(s,o){t(e,n).then((function(e){s(e.taskResults)}),(function(e){e instanceof Error?o(e):o(e.taskResults[e.rejectedIndexes[0]])}))}))}e.all=function(e,n){return s(e,Object.assign({},{failFast:!0},n))},e.raw=t,e.sync=function(e,n){return s(e,Object.assign({},{maxInProgress:1,failFast:!0},n))}}));
//# sourceMappingURL=throttle.js.map

@@ -19,5 +19,5 @@ export interface Result<T> {

}
export declare type Task<T> = () => Promise<T>;
export declare type Tasks<T> = Array<Task<T>>;
export declare type nextTaskCheck<T> = (status: Result<T>, tasks: Tasks<T>) => Promise<boolean>;
export type Task<T> = () => Promise<T>;
export type Tasks<T> = Array<Task<T>>;
export type nextTaskCheck<T> = (status: Result<T>, tasks: Tasks<T>) => Promise<boolean>;
/**

@@ -24,0 +24,0 @@ * Raw throttle function, which can return extra meta data.

{
"name": "promise-parallel-throttle",
"version": "3.3.0",
"version": "3.4.0",
"keywords": [

@@ -18,3 +18,2 @@ "promise",

"scripts": {
"precommit": "lint-staged",
"prepublish": "npm run build",

@@ -27,4 +26,5 @@ "test": "yarn lint && jest --coverage --no-cache",

"prebuild": "rimraf dist",
"build": "tsc --module commonjs && rollup -c rollup.config.ts",
"start": "rollup -c rollup.config.ts -w"
"build": "tsc --module commonjs && rollup -c rollup.config.ts --configPlugin typescript",
"start": "rollup -c rollup.config.ts -w --configPlugin typescript",
"prepare": "husky install"
},

@@ -58,28 +58,29 @@ "repository": {

"prettier --write",
"tslint -c ./tslint.json --fix",
"git add"
"tslint -c ./tslint.json --fix"
],
"*.{json,css,scss,md,graphl,js,jsx}": [
"prettier --write",
"git add"
"prettier --write"
]
},
"devDependencies": {
"@types/jest": "^23.3.10",
"@types/node": "^10.12.18",
"husky": "^1.2.1",
"jest": "^23.6.0",
"lint-staged": "^8.1.0",
"prettier": "^1.15.3",
"rollup": "^0.68.2",
"rollup-plugin-commonjs": "^9.2.0",
"rollup-plugin-sourcemaps": "^0.4.2",
"rollup-plugin-terser": "^3.0.0",
"rollup-plugin-typescript2": "^0.18.1",
"ts-jest": "^23.10.5",
"tslint": "^5.12.0",
"tslint-config-prettier": "^1.17.0",
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^11.1.6",
"@types/jest": "^29.5.12",
"@types/node": "^20.11.19",
"husky": "^9.0.11",
"jest": "^29.7.0",
"lint-staged": "^15.2.2",
"prettier": "^3.2.5",
"rimraf": "^5.0.5",
"rollup": "^4.11.0",
"ts-jest": "^29.1.2",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0",
"tslint-eslint-rules": "^5.4.0",
"typescript": "^3.2.2"
"typescript": "^5.3.3"
},
"engines": {
"node": ">=20.11.0",
"yarn": ">=1.22.0"
}
}
# Promise-parallel-throttle
[![Build Status](https://travis-ci.org/DJWassink/Promise-parallel-throttle.svg?branch=master)](https://travis-ci.org/DJWassink/Promise-parallel-throttle)
[![Build Status](https://github.com/DJWassink/Promise-parallel-throttle/actions/workflows/main.yml/badge.svg)](https://travis-ci.org/DJWassink/Promise-parallel-throttle)
[![npm version](https://badge.fury.io/js/promise-parallel-throttle.svg)](https://badge.fury.io/js/promise-parallel-throttle)
[![npm downloads](https://img.shields.io/npm/dm/promise-parallel-throttle.svg)](https://www.npmjs.com/package/promise-parallel-throttle)
[![Bundlephobia](https://img.shields.io/badge/dynamic/json.svg?label=minified%20size&url=https%3A%2F%2Fbundlephobia.com%2Fapi%2Fsize%3Fpackage%3Dpromise-parallel-throttle%26record%3Dtrue&query=size&suffix=%20bytes&colorB=%230a7bbc)](https://bundlephobia.com/result?p=promise-parallel-throttle)
[![Bundlephobia](https://img.shields.io/badge/dynamic/json.svg?label=minzipped%20size&url=https%3A%2F%2Fbundlephobia.com%2Fapi%2Fsize%3Fpackage%3Dpromise-parallel-throttle%26record%3Dtrue&query=gzip&suffix=%20bytes&colorB=%230a7bbc)](https://bundlephobia.com/result?p=promise-parallel-throttle)
[![Bundlephobia](https://badgen.net/bundlephobia/min/promise-parallel-throttle)](https://bundlephobia.com/result?p=promise-parallel-throttle)
[![Bundlephobia](https://badgen.net/bundlephobia/minzip/promise-parallel-throttle)](https://bundlephobia.com/result?p=promise-parallel-throttle)

@@ -9,0 +9,0 @@ Run a array of Promises in parallel. Kinda like Promise.all(), but throttled!

@@ -1,30 +0,21 @@

import commonjs from 'rollup-plugin-commonjs';
import sourceMaps from 'rollup-plugin-sourcemaps';
import {terser} from 'rollup-plugin-terser';
import typescript from 'rollup-plugin-typescript2';
import terser from '@rollup/plugin-terser';
import typescript from '@rollup/plugin-typescript';
const pkg = require('./package.json');
const sharedConfig = {
input: `src/throttle.ts`,
watch: {
include: 'src/**'
include: 'src/**',
},
plugins: [
// Compile TypeScript files
typescript({useTsconfigDeclarationDir: true}),
// Allow bundling cjs modules (unlike webpack, rollup doesn't understand cjs)
commonjs(),
// Resolve source maps to the original source
sourceMaps(),
typescript(),
// Minify the output
terser()
]
terser(),
],
};
const outputs = [
{file: pkg.main, name: 'throttle', format: 'umd', sourcemap: true},
{file: pkg.module, name: 'throttle', format: 'es', sourcemap: true}
{file: 'dist/lib/throttle.js', name: 'throttle', format: 'umd', sourcemap: true},
{file: 'dist/lib/throttle.mjs', name: 'throttle', format: 'es', sourcemap: true},
];
export default outputs.map(output => ({...sharedConfig, output}));
export default outputs.map((output) => ({...sharedConfig, output}));

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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