@gershy/util-throttler 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cmp/cjs/main.js CHANGED
@@ -8,15 +8,15 @@ class Throttler {
8
8
  pending;
9
9
  constructor(limit) {
10
10
  if (limit < 1)
11
- throw Error('limit too low')[mod]({ limit });
11
+ throw Error('limit too low')[cl.mod]({ limit });
12
12
  if (Math.floor(limit) !== limit)
13
- throw Error('limit invalid')[mod]({ limit });
13
+ throw Error('limit invalid')[cl.mod]({ limit });
14
14
  this.limit = limit;
15
15
  this.active = new Set();
16
16
  this.pending = [];
17
17
  }
18
18
  finish(donePrm) {
19
- this.active[rem](donePrm);
19
+ this.active[cl.rem](donePrm);
20
20
  const next = this.pending.shift();
21
21
  if (!next)
22
22
  return;
@@ -30,7 +30,7 @@ class Throttler {
30
30
  this.active.add(prm);
31
31
  return prm.finally(() => this.finish(prm));
32
32
  }
33
- const prm = Promise[later]();
33
+ const prm = Promise[cl.later]();
34
34
  this.pending.push({ prm, fn });
35
35
  return prm;
36
36
  }
package/cmp/mjs/main.js CHANGED
@@ -6,15 +6,15 @@ export default class Throttler {
6
6
  pending;
7
7
  constructor(limit) {
8
8
  if (limit < 1)
9
- throw Error('limit too low')[mod]({ limit });
9
+ throw Error('limit too low')[cl.mod]({ limit });
10
10
  if (Math.floor(limit) !== limit)
11
- throw Error('limit invalid')[mod]({ limit });
11
+ throw Error('limit invalid')[cl.mod]({ limit });
12
12
  this.limit = limit;
13
13
  this.active = new Set();
14
14
  this.pending = [];
15
15
  }
16
16
  finish(donePrm) {
17
- this.active[rem](donePrm);
17
+ this.active[cl.rem](donePrm);
18
18
  const next = this.pending.shift();
19
19
  if (!next)
20
20
  return;
@@ -28,7 +28,7 @@ export default class Throttler {
28
28
  this.active.add(prm);
29
29
  return prm.finally(() => this.finish(prm));
30
30
  }
31
- const prm = Promise[later]();
31
+ const prm = Promise[cl.later]();
32
32
  this.pending.push({ prm, fn });
33
33
  return prm;
34
34
  }
package/package.json CHANGED
@@ -1 +1,49 @@
1
- {"name":"@gershy/util-throttler","version":"0.0.1","description":"TODO","keywords":["TODO"],"author":"Gershom Maes","repository":{"type":"git","url":"git+https://github.com/gershy/utilThrottler.git"},"bugs":{"url":"https://github.com/gershy/utilThrottler/issues"},"homepage":"https://github.com/gershy/utilThrottler#readme","license":"ISC","peerDependencies":{"@gershy/clearing":"^0.0.17"},"devDependencies":{"@types/node":"^24.10.1","tsx":"^4.21.0","typescript":"^5.9.3"},"type":"module","files":["cmp"],"sideEffects":false,"types":"./cmp/mjs/main.d.ts","exports":{".":{"import":"./cmp/mjs/main.js","require":"./cmp/cjs/main.js"}},"scripts":{"test":"npm run ts.check && npx tsx ./src/main.test.ts","ts.check":"npx tsc --noEmit","build.cjs":"tsc -p build/tsconfig.cjs.json","build.mjs":"tsc -p build/tsconfig.mjs.json","build":"node ./build/act.js removeCmp && npm run build.cjs && npm run build.mjs && node ./build/act.js finalizeExportVariants","git.pub":"npm run test && git add --all && git commit -m \"automated\" && git push","npm.login":"npm login","npm.pub":"npm run test && npm run build && npm publish --access public"}}
1
+ {
2
+ "name": "@gershy/util-throttler",
3
+ "version": "0.0.3",
4
+ "description": "TODO",
5
+ "keywords": [
6
+ "TODO"
7
+ ],
8
+ "author": "Gershom Maes",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/gershy/utilThrottler.git"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/gershy/utilThrottler/issues"
15
+ },
16
+ "homepage": "https://github.com/gershy/utilThrottler#readme",
17
+ "license": "ISC",
18
+ "peerDependencies": {
19
+ "@gershy/clearing": "^0.0.36"
20
+ },
21
+ "devDependencies": {
22
+ "@types/node": "^24.10.1",
23
+ "tsx": "^4.21.0",
24
+ "typescript": "^5.9.3"
25
+ },
26
+ "type": "module",
27
+ "files": [
28
+ "cmp"
29
+ ],
30
+ "sideEffects": false,
31
+ "types": "./cmp/mjs/main.d.ts",
32
+ "exports": {
33
+ ".": {
34
+ "import": "./cmp/mjs/main.js",
35
+ "require": "./cmp/cjs/main.js"
36
+ }
37
+ },
38
+ "scripts": {
39
+ "test": "npm run ts.check && npx tsx ./src/main.test.ts",
40
+ "ts.check": "npx tsc --noEmit",
41
+ "build.cjs": "tsc -p build/tsconfig.cjs.json",
42
+ "build.mjs": "tsc -p build/tsconfig.mjs.json",
43
+ "build": "node ./build/act.js removeCmp && npm run build.cjs && npm run build.mjs && node ./build/act.js finalizeExportVariants",
44
+ "git.pub": "npm run test && git add --all && git commit -m \"automated\" && git push",
45
+ "npm.login": "npm login",
46
+ "npm.pub": "npm run test && npm run build && npm publish --access public"
47
+ },
48
+ "dependencies": {}
49
+ }