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

task-serializer

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

task-serializer - npm Package Compare versions

Comparing version 1.2.0 to 2.0.0

script-test.js

2

demo-async-iter.js

@@ -26,3 +26,3 @@ 'use strict';

async function main(){
let ai=new AsyncIter(2);
let ai=new AsyncIter({concurrentTaskLimit:2});
await Promise.all([producer(ai),consumer(ai)]);

@@ -29,0 +29,0 @@ }

{
"name": "task-serializer",
"version": "1.2.0",
"version": "2.0.0",
"description": "Serialize tasks/promises for integrated control. Option for limiting number of concurrent tasks.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -350,3 +350,5 @@ copyright 2020 craigphicks ISC license

- `const {AsyncIter}=require('task-serializer')`
- `instance=new AsyncIter({concurrentTaskLimit=0}={})`
- `AsyncIter.constructor({concurrentTaskLimit=0}={})`
- `AsyncIter.constructor(concurrentTaskLimit=0)`
- Either form of constructor (named/unnamed param) are allowed..
- See [API shared by all classes](#api-shared-by-all-classes).

@@ -373,3 +375,5 @@ - explicit async `instance.next()` or implicit async `for await (iter of instance)`

- `const {NextSymbol}=require('task-serializer')`
- `instance=new NextSymbol({concurrentTaskLimit=0}={})`
- `NextSymbol.constructor({concurrentTaskLimit=0}={})`
- `NextSymbol.constructor(concurrentTaskLimit=0)`
- Either form of constructor (named/unnamed param) are allowed..
- See [API shared by all classes](#api-shared-by-all-classes).

@@ -391,3 +395,5 @@ - async `instance.nextSymbol()`

- `const {WaitAll}=require('task-serializer')`
- `instance=new WaitAll({concurrentTaskLimit=0}={})`
- `WaitAll.constructor({concurrentTaskLimit=0}={})`
- `WaitAll.constructor(concurrentTaskLimit=0)`
- Either form of constructor (named/unnamed param) are allowed..
- See [API shared by all classes](#api-shared-by-all-classes).

@@ -406,3 +412,5 @@ - async `instance.waitAll()`

- `const {Callbacks}=require('task-serializer')`
- `instance=new Callbacks({concurrentTaskLimit=0}={})`
- `Callbacks.constructor({concurrentTaskLimit=0}={})`
- `Callbacks.constructor(concurrentTaskLimit=0)`
- Either form of constructor (named/unnamed param) are allowed..
- See [API shared by all classes](#api-shared-by-all-classes).

@@ -409,0 +417,0 @@ - `instance.onTaskResolved(callback)`

@@ -6,4 +6,6 @@ 'use strict';

class AsyncIter {
constructor(initCount){
this._sts=new TaskSerializer(initCount);
constructor({concurrentTaskLimit=0}={}){
if (Object.keys(arguments).includes('0'))
concurrentTaskLimit=arguments['0'];
this._sts=new TaskSerializer(concurrentTaskLimit);
this._q=[];

@@ -10,0 +12,0 @@ this._qe=[];

@@ -6,4 +6,6 @@ /* eslint-disable no-unused-vars */

class Callbacks{
constructor({concurrentLimit=0}={}){
this._ts=new TaskSerializer(concurrentLimit);
constructor({concurrentTaskLimit=0}={}){
if (Object.keys(arguments).includes('0'))
concurrentTaskLimit=arguments['0'];
this._ts=new TaskSerializer(concurrentTaskLimit);
}

@@ -10,0 +12,0 @@ onTaskResolved(cb){this._ts.onTaskResolved(cb);}

const {TaskSerializer}=require('./task-serializer.js');
class NextSymbol{
constructor({
concurrentTaskLimit=0,
}={}){
constructor({concurrentTaskLimit=0,}={}){
if (Object.keys(arguments).includes('0'))
concurrentTaskLimit=arguments['0'];
this._ts=new TaskSerializer(concurrentTaskLimit);

@@ -7,0 +7,0 @@ this._result=TaskSerializer._makepr();

const {TaskSerializer}=require('./task-serializer.js');
class WaitAll{
constructor({concurrentLimit=0}={}){
this._ts=new TaskSerializer(concurrentLimit);
constructor({concurrentTaskLimit=0}={}){
if (Object.keys(arguments).includes('0'))
concurrentTaskLimit=arguments['0'];
this._ts=new TaskSerializer(concurrentTaskLimit);
this._results=[];

@@ -6,0 +8,0 @@ this._error=TaskSerializer._makepr();

@@ -17,3 +17,3 @@ 'use strict';

async function main(){
let ai=new AsyncIter(2);
let ai=new AsyncIter({concurrentTaskLimit:2});
await Promise.all([producer(ai),consumer(ai)]);

@@ -20,0 +20,0 @@ }

@@ -17,3 +17,3 @@ 'use strict';

async function main(){
let ai=new AsyncIter(2);
let ai=new AsyncIter({concurrentTaskLimit:2});
await Promise.all([producer(ai),consumer(ai)]);

@@ -20,0 +20,0 @@ }

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