Socket
Socket
Sign inDemoInstall

@highoutput/async-group

Package Overview
Dependencies
Maintainers
5
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@highoutput/async-group - npm Package Compare versions

Comparing version 0.3.6 to 0.3.8

57

build/index.js

@@ -7,35 +7,32 @@ "use strict";

const v4_1 = __importDefault(require("uuid/v4"));
let AsyncGroup = (() => {
class AsyncGroup {
constructor() {
this.promises = new Map();
class AsyncGroup {
constructor() {
this.promises = new Map();
}
async add(promise) {
const id = (0, v4_1.default)();
this.promises.set(id, promise.finally(() => {
this.promises.delete(id);
}));
return promise;
}
async wait() {
while (this.promises.size > 0) {
const promises = Array.from(this.promises.values());
this.promises.clear();
await Promise.all(promises);
}
async add(promise) {
const id = v4_1.default();
this.promises.set(id, promise.finally(() => {
this.promises.delete(id);
}));
return promise;
}
async wait() {
while (this.promises.size > 0) {
const promises = Array.from(this.promises.values());
this.promises.clear();
await Promise.all(promises);
}
}
get size() {
return this.promises.size;
}
static async add(promise) {
return this.instance.add(promise);
}
static async wait() {
await this.instance.wait();
}
}
AsyncGroup.instance = new AsyncGroup();
return AsyncGroup;
})();
get size() {
return this.promises.size;
}
static async add(promise) {
return this.instance.add(promise);
}
static async wait() {
await this.instance.wait();
}
}
exports.default = AsyncGroup;
AsyncGroup.instance = new AsyncGroup();
//# sourceMappingURL=index.js.map
{
"name": "@highoutput/async-group",
"version": "0.3.6",
"version": "0.3.8",
"description": "Groups together multiple promises and allows to 'wait' for all of them to settle.",

@@ -23,3 +23,2 @@ "author": "High Output Ventures",

"@types/node": "^14.11.1",
"ckeditor5": "^29.0.0",
"uuid": "^3.4.0"

@@ -30,3 +29,3 @@ },

"rimraf": "^3.0.0",
"typescript": "^3.9.3"
"typescript": "^4.4.2"
},

@@ -36,3 +35,3 @@ "publishConfig": {

},
"gitHead": "76c143b8b6f06853048fb14a1e0c77e9edb4cb56"
"gitHead": "bbe508c18a9a819eec9288f41a741cd0aeaeeb92"
}

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