@ivan-angelkoski/counter 1.0.8 → 1.0.10

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/dist/index.cjs CHANGED
@@ -1,30 +1 @@
1
-
2
- //#region src/index.ts
3
- var Counter = class {
4
- count = 0;
5
- listeners = /* @__PURE__ */ new Set();
6
- constructor() {
7
- this.count = 0;
8
- }
9
- subscribe(listener) {
10
- this.listeners.add(listener);
11
- return () => {
12
- this.listeners.delete(listener);
13
- };
14
- }
15
- notify() {
16
- for (const listener of this.listeners) listener({ count: this.count });
17
- }
18
- increment(amount = 1) {
19
- this.count += amount;
20
- this.notify();
21
- }
22
- decrement(amount = 1) {
23
- this.count -= amount;
24
- this.notify();
25
- }
26
- };
27
-
28
- //#endregion
29
- exports.Counter = Counter;
30
- //# sourceMappingURL=index.cjs.map
1
+ var e=class{count=0;listeners=new Set;constructor(){this.count=0}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}notify(){for(let e of this.listeners)e(this.getState())}getState(){return{count:this.count}}increment(e=1){this.count+=e,this.notify()}decrement(e=1){this.count-=e,this.notify()}};exports.Counter=e;
package/dist/index.d.cts CHANGED
@@ -5,10 +5,13 @@ type State = {
5
5
  type Listener = (state: State) => void;
6
6
  declare class Counter {
7
7
  private count;
8
- listeners: Set<Listener>;
8
+ private listeners;
9
9
  constructor();
10
10
  subscribe(listener: Listener): () => void;
11
- notify(): void;
11
+ private notify;
12
+ getState(): {
13
+ count: number;
14
+ };
12
15
  increment(amount?: number): void;
13
16
  decrement(amount?: number): void;
14
17
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";KAAK,KAAA;EACH,KAAA;AAAA;AAAA,KAGG,QAAA,IAAY,KAAA,EAAO,KAAA;AAAA,cAEX,OAAA;EAAA,QACH,KAAA;EAER,SAAA,EAAW,GAAA,CAAI,QAAA;;EAMf,SAAA,CAAU,QAAA,EAAU,QAAA;EAQpB,MAAA,CAAA;EAMA,SAAA,CAAU,MAAA;EAKV,SAAA,CAAU,MAAA;AAAA"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";KAAK,KAAA;EACH,KAAA;AAAA;AAAA,KAGG,QAAA,IAAY,KAAA,EAAO,KAAA;AAAA,cAEX,OAAA;EAAA,QACH,KAAA;EAAA,QAEA,SAAA;;EAMR,SAAA,CAAU,QAAA,EAAU,QAAA;EAAA,QAQZ,MAAA;EAMR,QAAA,CAAA;;;EAIA,SAAA,CAAU,MAAA;EAKV,SAAA,CAAU,MAAA;AAAA"}
@@ -5,13 +5,16 @@ type State = {
5
5
  type Listener = (state: State) => void;
6
6
  declare class Counter {
7
7
  private count;
8
- listeners: Set<Listener>;
8
+ private listeners;
9
9
  constructor();
10
10
  subscribe(listener: Listener): () => void;
11
- notify(): void;
11
+ private notify;
12
+ getState(): {
13
+ count: number;
14
+ };
12
15
  increment(amount?: number): void;
13
16
  decrement(amount?: number): void;
14
17
  }
15
18
  //#endregion
16
19
  export { Counter };
17
- //# sourceMappingURL=index.d.mts.map
20
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"mappings":";KAAK,KAAA;EACH,KAAA;AAAA;AAAA,KAGG,QAAA,IAAY,KAAA,EAAO,KAAA;AAAA,cAEX,OAAA;EAAA,QACH,KAAA;EAAA,QAEA,SAAA;;EAMR,SAAA,CAAU,QAAA,EAAU,QAAA;EAAA,QAQZ,MAAA;EAMR,QAAA,CAAA;;;EAIA,SAAA,CAAU,MAAA;EAKV,SAAA,CAAU,MAAA;AAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ var e=class{count=0;listeners=new Set;constructor(){this.count=0}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}notify(){for(let e of this.listeners)e(this.getState())}getState(){return{count:this.count}}increment(e=1){this.count+=e,this.notify()}decrement(e=1){this.count-=e,this.notify()}};export{e as Counter};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["type State = {\n count: number;\n};\n\ntype Listener = (state: State) => void;\n\nexport class Counter {\n private count: number = 0;\n\n private listeners: Set<Listener> = new Set();\n\n constructor() {\n this.count = 0;\n }\n\n subscribe(listener: Listener) {\n this.listeners.add(listener);\n\n return () => {\n this.listeners.delete(listener);\n };\n }\n\n private notify() {\n for (const listener of this.listeners) {\n listener(this.getState());\n }\n }\n\n getState() {\n return { count: this.count };\n }\n\n increment(amount: number = 1) {\n this.count += amount;\n this.notify();\n }\n\n decrement(amount: number = 1) {\n this.count -= amount;\n this.notify();\n }\n}\n"],"mappings":"AAMA,IAAa,EAAb,KAAqB,CACnB,MAAwB,EAExB,UAAmC,IAAI,IAEvC,aAAc,CACZ,KAAK,MAAQ,EAGf,UAAU,EAAoB,CAG5B,OAFA,KAAK,UAAU,IAAI,EAAS,KAEf,CACX,KAAK,UAAU,OAAO,EAAS,EAInC,QAAiB,CACf,IAAK,IAAM,KAAY,KAAK,UAC1B,EAAS,KAAK,UAAU,CAAC,CAI7B,UAAW,CACT,MAAO,CAAE,MAAO,KAAK,MAAO,CAG9B,UAAU,EAAiB,EAAG,CAC5B,KAAK,OAAS,EACd,KAAK,QAAQ,CAGf,UAAU,EAAiB,EAAG,CAC5B,KAAK,OAAS,EACd,KAAK,QAAQ"}
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@ivan-angelkoski/counter",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "description": "Test counter package with changesets",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
7
- "module": "dist/index.mjs",
8
- "types": "dist/index.d.mts",
7
+ "module": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
9
  "exports": {
10
10
  ".": {
11
11
  "import": {
12
- "types": "./dist/index.d.mts",
13
- "default": "./dist/index.mjs"
12
+ "types": "./dist/index.d.ts",
13
+ "default": "./dist/index.js"
14
14
  },
15
15
  "require": {
16
16
  "types": "./dist/index.d.cts",
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["type State = {\n count: number;\n};\n\ntype Listener = (state: State) => void;\n\nexport class Counter {\n private count: number = 0;\n\n listeners: Set<Listener> = new Set();\n\n constructor() {\n this.count = 0;\n }\n\n subscribe(listener: Listener) {\n this.listeners.add(listener);\n\n return () => {\n this.listeners.delete(listener);\n };\n }\n\n notify() {\n for (const listener of this.listeners) {\n listener({ count: this.count });\n }\n }\n\n increment(amount: number = 1) {\n this.count += amount;\n this.notify();\n }\n\n decrement(amount: number = 1) {\n this.count -= amount;\n this.notify();\n }\n}\n"],"mappings":";;AAMA,IAAa,UAAb,MAAqB;CACnB,AAAQ,QAAgB;CAExB,4BAA2B,IAAI,KAAK;CAEpC,cAAc;AACZ,OAAK,QAAQ;;CAGf,UAAU,UAAoB;AAC5B,OAAK,UAAU,IAAI,SAAS;AAE5B,eAAa;AACX,QAAK,UAAU,OAAO,SAAS;;;CAInC,SAAS;AACP,OAAK,MAAM,YAAY,KAAK,UAC1B,UAAS,EAAE,OAAO,KAAK,OAAO,CAAC;;CAInC,UAAU,SAAiB,GAAG;AAC5B,OAAK,SAAS;AACd,OAAK,QAAQ;;CAGf,UAAU,SAAiB,GAAG;AAC5B,OAAK,SAAS;AACd,OAAK,QAAQ"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";KAAK,KAAA;EACH,KAAA;AAAA;AAAA,KAGG,QAAA,IAAY,KAAA,EAAO,KAAA;AAAA,cAEX,OAAA;EAAA,QACH,KAAA;EAER,SAAA,EAAW,GAAA,CAAI,QAAA;;EAMf,SAAA,CAAU,QAAA,EAAU,QAAA;EAQpB,MAAA,CAAA;EAMA,SAAA,CAAU,MAAA;EAKV,SAAA,CAAU,MAAA;AAAA"}
package/dist/index.mjs DELETED
@@ -1,29 +0,0 @@
1
- //#region src/index.ts
2
- var Counter = class {
3
- count = 0;
4
- listeners = /* @__PURE__ */ new Set();
5
- constructor() {
6
- this.count = 0;
7
- }
8
- subscribe(listener) {
9
- this.listeners.add(listener);
10
- return () => {
11
- this.listeners.delete(listener);
12
- };
13
- }
14
- notify() {
15
- for (const listener of this.listeners) listener({ count: this.count });
16
- }
17
- increment(amount = 1) {
18
- this.count += amount;
19
- this.notify();
20
- }
21
- decrement(amount = 1) {
22
- this.count -= amount;
23
- this.notify();
24
- }
25
- };
26
-
27
- //#endregion
28
- export { Counter };
29
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["type State = {\n count: number;\n};\n\ntype Listener = (state: State) => void;\n\nexport class Counter {\n private count: number = 0;\n\n listeners: Set<Listener> = new Set();\n\n constructor() {\n this.count = 0;\n }\n\n subscribe(listener: Listener) {\n this.listeners.add(listener);\n\n return () => {\n this.listeners.delete(listener);\n };\n }\n\n notify() {\n for (const listener of this.listeners) {\n listener({ count: this.count });\n }\n }\n\n increment(amount: number = 1) {\n this.count += amount;\n this.notify();\n }\n\n decrement(amount: number = 1) {\n this.count -= amount;\n this.notify();\n }\n}\n"],"mappings":";AAMA,IAAa,UAAb,MAAqB;CACnB,AAAQ,QAAgB;CAExB,4BAA2B,IAAI,KAAK;CAEpC,cAAc;AACZ,OAAK,QAAQ;;CAGf,UAAU,UAAoB;AAC5B,OAAK,UAAU,IAAI,SAAS;AAE5B,eAAa;AACX,QAAK,UAAU,OAAO,SAAS;;;CAInC,SAAS;AACP,OAAK,MAAM,YAAY,KAAK,UAC1B,UAAS,EAAE,OAAO,KAAK,OAAO,CAAC;;CAInC,UAAU,SAAiB,GAAG;AAC5B,OAAK,SAAS;AACd,OAAK,QAAQ;;CAGf,UAAU,SAAiB,GAAG;AAC5B,OAAK,SAAS;AACd,OAAK,QAAQ"}