foxts 5.5.0 → 5.5.1

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.
@@ -1,6 +1,8 @@
1
1
  declare class Counter<K extends string> {
2
2
  private readonly map;
3
3
  constructor(init?: Array<[K, number]> | Record<K, number>);
4
+ forEach(callbackfn: (value: number, key: K, map: Map<K, number>) => void, thisArg?: any): void;
5
+ [Symbol.toStringTag]: string;
4
6
  get size(): number;
5
7
  clear(): void;
6
8
  delete(key: K): boolean;
@@ -8,8 +10,9 @@ declare class Counter<K extends string> {
8
10
  get(key: K): number;
9
11
  incr(key: K, n?: number): this;
10
12
  decr(key: K, n?: number): this;
11
- entries(): IterableIterator<readonly [K, number]>;
12
- keys(): IterableIterator<K>;
13
+ entries(): MapIterator<[K, number]>;
14
+ [Symbol.iterator](): MapIterator<[K, number]>;
15
+ keys(): MapIterator<K>;
13
16
  }
14
17
 
15
18
  export { Counter };
@@ -1 +1 @@
1
- "use strict";class t{map=new Map;constructor(t){if(Array.isArray(t))for(const[e,r]of t)this.incr(e,r);else if(void 0!==t)for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&this.incr(e,t[e])}get size(){return this.map.size}clear(){this.map.clear()}delete(t){return this.map.delete(t)}has(t){return this.map.has(t)}get(t){const e=this.map.get(t);return void 0===e?0:e}incr(t,e=1){if(e<0)throw TypeError(`Counter#incr only accepts positive values: ${e}`);return this.map.set(t,this.get(t)+e),this}decr(t,e=1){if(e<0)throw TypeError(`Counter#decr only accepts positive values: ${e}`);const r=this.get(t);return r<=e?this.map.delete(t):this.map.set(t,r-e),this}entries(){return this.map.entries()}keys(){return this.map.keys()}}exports.Counter=t;
1
+ "use strict";var t,r;t=Symbol.toStringTag,r=Symbol.iterator;class e{map=new Map;constructor(t){if(Array.isArray(t))for(const[r,e]of t)this.incr(r,e);else if(void 0!==t)for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&this.incr(r,t[r])}forEach(t,r){this.map.forEach(t,r)}[t]="Counter";get size(){return this.map.size}clear(){this.map.clear()}delete(t){return this.map.delete(t)}has(t){return this.map.has(t)}get(t){const r=this.map.get(t);return void 0===r?0:r}incr(t,r=1){if(r<0)throw TypeError(`Counter#incr only accepts positive values: ${r}`);return this.map.set(t,this.get(t)+r),this}decr(t,r=1){if(r<0)throw TypeError(`Counter#decr only accepts positive values: ${r}`);const e=this.get(t);return e<=r?this.map.delete(t):this.map.set(t,e-r),this}entries(){return this.map.entries()}[r](){return this.map[Symbol.iterator]()}keys(){return this.map.keys()}}exports.Counter=e;
@@ -1 +1 @@
1
- class t{map=new Map;constructor(t){if(Array.isArray(t))for(const[e,r]of t)this.incr(e,r);else if(void 0!==t)for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&this.incr(e,t[e])}get size(){return this.map.size}clear(){this.map.clear()}delete(t){return this.map.delete(t)}has(t){return this.map.has(t)}get(t){const e=this.map.get(t);return void 0===e?0:e}incr(t,e=1){if(e<0)throw TypeError(`Counter#incr only accepts positive values: ${e}`);return this.map.set(t,this.get(t)+e),this}decr(t,e=1){if(e<0)throw TypeError(`Counter#decr only accepts positive values: ${e}`);const r=this.get(t);return r<=e?this.map.delete(t):this.map.set(t,r-e),this}entries(){return this.map.entries()}keys(){return this.map.keys()}}export{t as Counter};
1
+ var t,r;t=Symbol.toStringTag,r=Symbol.iterator;class e{map=new Map;constructor(t){if(Array.isArray(t))for(const[r,e]of t)this.incr(r,e);else if(void 0!==t)for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&this.incr(r,t[r])}forEach(t,r){this.map.forEach(t,r)}[t]="Counter";get size(){return this.map.size}clear(){this.map.clear()}delete(t){return this.map.delete(t)}has(t){return this.map.has(t)}get(t){const r=this.map.get(t);return void 0===r?0:r}incr(t,r=1){if(r<0)throw TypeError(`Counter#incr only accepts positive values: ${r}`);return this.map.set(t,this.get(t)+r),this}decr(t,r=1){if(r<0)throw TypeError(`Counter#decr only accepts positive values: ${r}`);const e=this.get(t);return e<=r?this.map.delete(t):this.map.set(t,e-r),this}entries(){return this.map.entries()}[r](){return this.map[Symbol.iterator]()}keys(){return this.map.keys()}}export{e as Counter};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foxts",
3
- "version": "5.5.0",
3
+ "version": "5.5.1",
4
4
  "description": "Opinionated collection of common TypeScript utils by @SukkaW",
5
5
  "repository": {
6
6
  "url": "https://github.com/SukkaW/foxts"