danholibraryjs 2.0.0 → 2.0.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.
Files changed (62) hide show
  1. package/README.md +0 -1
  2. package/_package.github-release.json +6 -0
  3. package/_package.npm-release.json +6 -0
  4. package/dist/Extensions/Array/index.d.ts +6 -20
  5. package/dist/Extensions/Array/index.js +8 -26
  6. package/dist/Extensions/Object/index.d.ts +4 -10
  7. package/dist/Extensions/Object/index.js +6 -22
  8. package/dist/Extensions/Object/properties.extension.d.ts +28 -1
  9. package/dist/Extensions/Object/properties.extension.js +19 -2
  10. package/dist/Extensions/Object/properties.js +2 -1
  11. package/dist/Extensions/String/index.d.ts +1 -4
  12. package/dist/Extensions/String/index.js +3 -16
  13. package/dist/Extensions/index.d.ts +2 -2
  14. package/dist/Extensions/index.js +2 -2
  15. package/dist/index.d.ts +0 -1
  16. package/dist/index.js +0 -1
  17. package/docs/Classes.md +78 -3
  18. package/docs/Extensions.md +219 -78
  19. package/docs/Types.md +202 -58
  20. package/docs/index.md +0 -1
  21. package/package.json +1 -1
  22. package/src/Extensions/Array/index.ts +6 -15
  23. package/src/Extensions/Object/index.ts +4 -11
  24. package/src/Extensions/Object/properties.extension.ts +50 -2
  25. package/src/Extensions/Object/properties.ts +2 -1
  26. package/src/Extensions/String/index.ts +1 -5
  27. package/src/Extensions/index.ts +2 -2
  28. package/src/index.ts +0 -1
  29. package/dist/Extensions/Array.d.ts +0 -52
  30. package/dist/Extensions/Array.js +0 -51
  31. package/dist/Extensions/Document.d.ts +0 -27
  32. package/dist/Extensions/Document.js +0 -32
  33. package/dist/Extensions/String.d.ts +0 -36
  34. package/dist/Extensions/String.js +0 -25
  35. package/dist/Functions/CopyToClipboard.d.ts +0 -7
  36. package/dist/Functions/CopyToClipboard.js +0 -15
  37. package/dist/Functions/GetCSSProperty.d.ts +0 -15
  38. package/dist/Functions/GetCSSProperty.js +0 -26
  39. package/dist/Functions/GetNestedProperty.d.ts +0 -9
  40. package/dist/Functions/GetNestedProperty.js +0 -23
  41. package/dist/Functions/HTMLEvent.d.ts +0 -11
  42. package/dist/Functions/HTMLEvent.js +0 -14
  43. package/dist/Functions/SetNavigationSelected.d.ts +0 -9
  44. package/dist/Functions/SetNavigationSelected.js +0 -25
  45. package/dist/Functions/index.d.ts +0 -5
  46. package/dist/Functions/index.js +0 -21
  47. package/dist/Utils/ApiUtil/ApiTypes.d.ts +0 -15
  48. package/dist/Utils/ApiUtil/ApiTypes.js +0 -15
  49. package/dist/Utils/ApiUtil/RequestUtil.d.ts +0 -19
  50. package/dist/Utils/ApiUtil/RequestUtil.js +0 -73
  51. package/dist/Utils/ApiUtil/index.d.ts +0 -20
  52. package/dist/Utils/ApiUtil/index.js +0 -33
  53. package/dist/Utils/FormUtil.d.ts +0 -6
  54. package/dist/Utils/FormUtil.js +0 -35
  55. package/docs/Functions.md +0 -61
  56. package/src/Extensions/Document.ts +0 -58
  57. package/src/Functions/CopyToClipboard.ts +0 -10
  58. package/src/Functions/GetCSSProperty.ts +0 -27
  59. package/src/Functions/GetNestedProperty.ts +0 -29
  60. package/src/Functions/HTMLEvent.ts +0 -13
  61. package/src/Functions/SetNavigationSelected.ts +0 -19
  62. package/src/Functions/index.ts +0 -5
package/README.md CHANGED
@@ -24,6 +24,5 @@ import { ... } from 'DanhoLibraryJS';
24
24
 
25
25
  * [Classes](/docs/Classes.md)
26
26
  * [Extensions](/docs/Extensions.md)
27
- * [Functions](/docs/Functions.md)
28
27
  * [Interfaces](/docs/Interfaces.md)
29
28
  * [Types](/docs/Types.md)
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "@danielsimonsen90/danholibraryjs",
3
+ "publishConfig": {
4
+ "registry": "https://npm.pkg.github.com/"
5
+ }
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "danholibraryjs",
3
+ "publishConfig": {
4
+ "registry": "https://registry.npmjs.org/"
5
+ }
6
+ }
@@ -1,20 +1,6 @@
1
- import * as CRUD from './crud.extension';
2
- export declare const ArrayExtensions: {
3
- join<T>(this: T[], separator?: string, endSeparator?: string): string;
4
- orderBy<T_1>(this: T_1[], ...comparators: ((a: T_1, b: T_1) => number)[]): T_1[];
5
- orderByDescending<T_2>(this: T_2[], ...comparators: ((a: T_2, b: T_2) => number)[]): T_2[];
6
- sortByProperty<T_3 extends object>(this: T_3[], ...properties: (keyof T_3)[]): T_3[];
7
- random<T_4>(this: T_4[]): T_4;
8
- shuffle<T_5>(this: T_5[]): T_5[];
9
- randomWithPercentages<T_6>(items: [item: T_6, weight: number][]): T_6;
10
- nth<T_7, U>(this: T_7[], every: number, callback: (item: T_7, index: number, collection: T_7[], self: T_7[]) => U): U[];
11
- add<T_8>(this: T_8[], ...items: T_8[]): T_8[];
12
- update<T_9>(this: T_9[], old: number | T_9 | CRUD.UpdateFinder<T_9>, updated: T_9): T_9;
13
- remove<T_10>(this: T_10[], value: number | T_10): T_10[];
14
- take<T_11>(this: T_11[], count: number): T_11[];
15
- forceArray<T_12>(arrayable: import("../..").Arrayable<T_12>): T_12[];
16
- unique<T_13>(this: T_13[]): T_13[];
17
- splitBy<T_14>(this: T_14[], chunkSize: number): T_14[][];
18
- splitBy<T_15>(this: T_15[], splitter: (value: T_15, index: number, array: T_15[]) => boolean): T_15[][];
19
- groupBy<T_16, K>(this: T_16[], keySelector: (value: T_16, index: number, array: T_16[]) => K): Map<K, T_16[]>;
20
- };
1
+ export * from './array.extension';
2
+ export * from './crud.extension';
3
+ export * from './loop.extension';
4
+ export * from './random.extension';
5
+ export * from './sort.extension';
6
+ export * from './string.extension';
@@ -10,31 +10,13 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
10
10
  if (k2 === undefined) k2 = k;
11
11
  o[k2] = m[k];
12
12
  }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
24
15
  };
25
16
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.ArrayExtensions = void 0;
27
- const Array = __importStar(require("./array.extension"));
28
- const CRUD = __importStar(require("./crud.extension"));
29
- const Loop = __importStar(require("./loop.extension"));
30
- const Random = __importStar(require("./random.extension"));
31
- const Sort = __importStar(require("./sort.extension"));
32
- const String = __importStar(require("./string.extension"));
33
- exports.ArrayExtensions = {
34
- ...Array,
35
- ...CRUD,
36
- ...Loop,
37
- ...Random,
38
- ...Sort,
39
- ...String,
40
- };
17
+ __exportStar(require("./array.extension"), exports);
18
+ __exportStar(require("./crud.extension"), exports);
19
+ __exportStar(require("./loop.extension"), exports);
20
+ __exportStar(require("./random.extension"), exports);
21
+ __exportStar(require("./sort.extension"), exports);
22
+ __exportStar(require("./string.extension"), exports);
@@ -1,10 +1,4 @@
1
- export declare const ObjectExtensions: {
2
- omit<From extends {}, Props extends keyof From>(from: From, ...props: (Props | Partial<From>)[]): Omit<From, Props>;
3
- pick<From_1 extends {}, Props_1 extends keyof From_1>(from: From_1, ...props: (Props_1 | Partial<From_1>)[]): Pick<From_1, Props_1>;
4
- difference<T extends object>(source: T, target: T, ...exclude: (keyof T)[]): Omit<T, keyof T>;
5
- combine<T_1 extends Record<string, any>>(...objects: ({ [key in keyof T_1]?: (T_1[key] extends Record<string, any> ? T_1[key] extends infer T_2 extends Record<string, any> ? { [key_1 in keyof T_2]?: (T_1[key][key_1] extends Record<string, any> ? T_1[key][key_1] extends infer T_3 extends Record<string, any> ? { [key_2 in keyof T_3]?: (T_1[key][key_1][key_2] extends Record<string, any> ? T_1[key][key_1][key_2] extends infer T_4 extends Record<string, any> ? { [key_3 in keyof T_4]?: (T_1[key][key_1][key_2][key_3] extends Record<string, any> ? T_1[key][key_1][key_2][key_3] extends infer T_5 extends Record<string, any> ? { [key_4 in keyof T_5]?: (T_1[key][key_1][key_2][key_3][key_4] extends Record<string, any> ? T_1[key][key_1][key_2][key_3][key_4] extends infer T_6 extends Record<string, any> ? { [key_5 in keyof T_6]?: (T_1[key][key_1][key_2][key_3][key_4][key_5] extends Record<string, any> ? T_1[key][key_1][key_2][key_3][key_4][key_5] extends infer T_7 extends Record<string, any> ? { [key_6 in keyof T_7]?: (T_1[key][key_1][key_2][key_3][key_4][key_5][key_6] extends Record<string, any> ? T_1[key][key_1][key_2][key_3][key_4][key_5][key_6] extends infer T_8 extends Record<string, any> ? { [key_7 in keyof T_8]?: (T_1[key][key_1][key_2][key_3][key_4][key_5][key_6][key_7] extends Record<string, any> ? T_1[key][key_1][key_2][key_3][key_4][key_5][key_6][key_7] extends infer T_9 extends Record<string, any> ? { [key_8 in keyof T_9]?: (T_1[key][key_1][key_2][key_3][key_4][key_5][key_6][key_7][key_8] extends Record<string, any> ? T_1[key][key_1][key_2][key_3][key_4][key_5][key_6][key_7][key_8] extends infer T_10 extends Record<string, any> ? { [key_9 in keyof T_10]?: (T_1[key][key_1][key_2][key_3][key_4][key_5][key_6][key_7][key_8][key_9] extends Record<string, any> ? T_1[key][key_1][key_2][key_3][key_4][key_5][key_6][key_7][key_8][key_9] extends infer T_11 extends Record<string, any> ? { [key_10 in keyof T_11]?: (T_1[key][key_1][key_2][key_3][key_4][key_5][key_6][key_7][key_8][key_9][key_10] extends Record<string, any> ? any : T_1[key][key_1][key_2][key_3][key_4][key_5][key_6][key_7][key_8][key_9][key_10]) | undefined; } : never : T_1[key][key_1][key_2][key_3][key_4][key_5][key_6][key_7][key_8][key_9]) | undefined; } : never : T_1[key][key_1][key_2][key_3][key_4][key_5][key_6][key_7][key_8]) | undefined; } : never : T_1[key][key_1][key_2][key_3][key_4][key_5][key_6][key_7]) | undefined; } : never : T_1[key][key_1][key_2][key_3][key_4][key_5][key_6]) | undefined; } : never : T_1[key][key_1][key_2][key_3][key_4][key_5]) | undefined; } : never : T_1[key][key_1][key_2][key_3][key_4]) | undefined; } : never : T_1[key][key_1][key_2][key_3]) | undefined; } : never : T_1[key][key_1][key_2]) | undefined; } : never : T_1[key][key_1]) | undefined; } : never : T_1[key]) | undefined; } | undefined)[]): T_1;
6
- areEqual<T_12 extends object | null>(a?: T_12 | undefined, b?: T_12 | undefined): boolean;
7
- isNullOrUndefined(obj: any): obj is null | undefined;
8
- array<From_2 extends {} = {}>(this: object, from: From_2): [keyof From_2, import("../..").ValueOf<From_2>][];
9
- keysOf<From_3 extends {} = {}>(this: object, from: From_3): (keyof From_3)[];
10
- };
1
+ export * from './arrays.extension';
2
+ export * from './booleans.extension';
3
+ export * from './extracts.extension';
4
+ export * from './properties.extension';
@@ -10,27 +10,11 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
10
10
  if (k2 === undefined) k2 = k;
11
11
  o[k2] = m[k];
12
12
  }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
24
15
  };
25
16
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.ObjectExtensions = void 0;
27
- const Array = __importStar(require("./arrays.extension"));
28
- const Booleans = __importStar(require("./booleans.extension"));
29
- const Extracts = __importStar(require("./extracts.extension"));
30
- const Properties = __importStar(require("./properties.extension"));
31
- exports.ObjectExtensions = {
32
- ...Array,
33
- ...Booleans,
34
- ...Extracts,
35
- ...Properties
36
- };
17
+ __exportStar(require("./arrays.extension"), exports);
18
+ __exportStar(require("./booleans.extension"), exports);
19
+ __exportStar(require("./extracts.extension"), exports);
20
+ __exportStar(require("./properties.extension"), exports);
@@ -1,6 +1,33 @@
1
- import { Properties } from "./properties";
1
+ import { PropertiesWith, If } from '../../Types';
2
+ type PrimitiveMap = {
3
+ string: string;
4
+ number: number;
5
+ boolean: boolean;
6
+ undefined: undefined;
7
+ null: null;
8
+ object: object;
9
+ function: Function;
10
+ any: any;
11
+ Date: Date;
12
+ RegExp: RegExp;
13
+ Promise: Promise<any>;
14
+ Array: Array<any>;
15
+ Map: Map<any, any>;
16
+ Set: Set<any>;
17
+ };
18
+ /**
19
+ * Object with getPrimitiveTypes<Source, AllowFunctions extends boolean>(
20
+ * source: Source,
21
+ * allowFunctions: AllowFunctions = false
22
+ * ): Object with properties from source that matches primitive type
23
+ */
24
+ export type Properties = {
25
+ [Key in keyof PrimitiveMap as `get${Capitalize<Key>}s`]: <Source extends {}, AllowFunctions extends boolean = false>(source: Source, withFunctions?: AllowFunctions) => If<AllowFunctions, PropertiesWith<PrimitiveMap[Key] | ((...args: any[]) => PrimitiveMap[Key]), Source>, PropertiesWith<PrimitiveMap[Key], Source>>;
26
+ };
2
27
  declare global {
3
28
  interface ObjectConstructor {
4
29
  properties: Properties;
5
30
  }
6
31
  }
32
+ export declare const properties: Properties;
33
+ export {};
@@ -1,4 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const properties_1 = require("./properties");
4
- Object.properties = properties_1.properties;
3
+ exports.properties = void 0;
4
+ const case_extension_1 = require("../String/case.extension");
5
+ exports.properties = [
6
+ 'string', 'number', 'boolean', 'undefined', 'null',
7
+ 'object', 'function', 'any',
8
+ 'Date', 'RegExp', 'Promise', 'Array', 'Map', 'Set'
9
+ ].reduce((result, primitive) => {
10
+ result[`get${(0, case_extension_1.convertCase)('camel', 'pascal')}s`] = function (source, withFunctions = false) {
11
+ return Object.keysOf(source).reduce((result, key) => {
12
+ if (source[key].constructor.name === primitive ||
13
+ (withFunctions && typeof source[key] === 'function' && source[key]).constructor.name === primitive) {
14
+ result[key] = source[key];
15
+ }
16
+ return result;
17
+ }, {});
18
+ };
19
+ return result;
20
+ }, {});
21
+ Object.properties = exports.properties;
@@ -1,12 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.properties = void 0;
4
+ const case_extension_1 = require("../String/case.extension");
4
5
  exports.properties = [
5
6
  'string', 'number', 'boolean', 'undefined', 'null',
6
7
  'object', 'function', 'any',
7
8
  'Date', 'RegExp', 'Promise', 'Array', 'Map', 'Set'
8
9
  ].reduce((result, primitive) => {
9
- result[`get${primitive.convertCase('camel', 'pascal')}s`] = function (source, withFunctions = false) {
10
+ result[`get${(0, case_extension_1.convertCase)('camel', 'pascal')}s`] = function (source, withFunctions = false) {
10
11
  return Object.keysOf(source).reduce((result, key) => {
11
12
  if (source[key].constructor.name === primitive ||
12
13
  (withFunctions && typeof source[key] === 'function' && source[key]).constructor.name === primitive) {
@@ -1,4 +1 @@
1
- import * as Case from './case.extension';
2
- export declare const StringUtils: {
3
- convertCase: <TValue extends string, To extends Case.Case[], Return extends To extends [...Case.Case[], infer To_1] ? To_1 : Case.Case>(value: TValue, from: Case.Case, ...to: To) => Return extends "upper" ? Uppercase<TValue> : Return extends "lower" ? Lowercase<TValue> : Return extends "pascal" ? Capitalize<TValue> : Return extends "camel" ? Uncapitalize<TValue> : string;
4
- };
1
+ export * from './case.extension';
@@ -10,21 +10,8 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
10
10
  if (k2 === undefined) k2 = k;
11
11
  o[k2] = m[k];
12
12
  }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
24
15
  };
25
16
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.StringUtils = void 0;
27
- const Case = __importStar(require("./case.extension"));
28
- exports.StringUtils = {
29
- ...Case,
30
- };
17
+ __exportStar(require("./case.extension"), exports);
@@ -1,6 +1,6 @@
1
1
  export * from './Array';
2
- export * from './Document';
2
+ export * from './Function';
3
3
  export * from './Map';
4
- export * from './Object';
5
4
  export * from './Number';
5
+ export * from './Object';
6
6
  export * from './String';
@@ -15,8 +15,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./Array"), exports);
18
- __exportStar(require("./Document"), exports);
18
+ __exportStar(require("./Function"), exports);
19
19
  __exportStar(require("./Map"), exports);
20
- __exportStar(require("./Object"), exports);
21
20
  __exportStar(require("./Number"), exports);
21
+ __exportStar(require("./Object"), exports);
22
22
  __exportStar(require("./String"), exports);
package/dist/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  export * from './Classes';
2
2
  export * from './Extensions';
3
- export * from './Functions';
4
3
  export * from './Interfaces';
5
4
  export * from './Types';
package/dist/index.js CHANGED
@@ -16,6 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./Classes"), exports);
18
18
  __exportStar(require("./Extensions"), exports);
19
- __exportStar(require("./Functions"), exports);
20
19
  __exportStar(require("./Interfaces"), exports);
21
20
  __exportStar(require("./Types"), exports);
package/docs/Classes.md CHANGED
@@ -2,11 +2,86 @@
2
2
 
3
3
  ## Classes
4
4
 
5
+ ### DanhoLogger
6
+
7
+ ```ts
8
+ /**
9
+ * Enhanced console logger with prefixes, colors, and grouping
10
+ */
11
+ class DanhoLogger {
12
+ /**
13
+ * @param options Logger configuration
14
+ * @param options.name Name to display in log prefix (default: 'DanhoLogger')
15
+ * @param options.color Color for the prefix (default: 'inherit')
16
+ * @param options.preferCollapsed Whether to use collapsed groups by default (default: false)
17
+ */
18
+ constructor(options?: { name?: string; color?: string; preferCollapsed?: boolean });
19
+
20
+ /**
21
+ * Name displayed in log prefix
22
+ */
23
+ public name: string;
24
+
25
+ /**
26
+ * Color for the prefix
27
+ */
28
+ public color?: string;
29
+
30
+ /**
31
+ * Logs a message
32
+ */
33
+ public log(...args: any[]): this;
34
+
35
+ /**
36
+ * Logs a warning message
37
+ */
38
+ public warn(...args: any[]): this;
39
+
40
+ /**
41
+ * Logs an error message
42
+ */
43
+ public error(...args: any[]): this;
44
+
45
+ /**
46
+ * Creates a log group
47
+ */
48
+ public group(...args: any[]): this;
49
+
50
+ /**
51
+ * Creates a collapsed log group
52
+ */
53
+ public groupCollapsed(...args: any[]): this;
54
+
55
+ /**
56
+ * Ends the current log group
57
+ */
58
+ public groupEnd(...args: any[]): this;
59
+
60
+ /**
61
+ * Starts a timer with a label
62
+ */
63
+ public time(label: string): this;
64
+
65
+ /**
66
+ * Ends a timer and logs the elapsed time
67
+ */
68
+ public timeEnd(label: string): this;
69
+
70
+ /**
71
+ * Logs data in a table format
72
+ */
73
+ public table(data: any, columns?: string[]): this;
74
+ }
75
+ ```
76
+
77
+ ### Store
78
+
5
79
  ```ts
6
80
  /**
7
- * EventEmitter, but it stores state and handles state change with reducers
81
+ * EventEmitter that stores state and handles state changes with reducers
8
82
  *
9
- * @Initialization Actions & initial state must be defined in type parameters. InitialState must be provided in constructor, whereas reducer is optional.
83
+ * @Initialization Actions & initial state must be defined in type parameters.
84
+ * InitialState must be provided in constructor, whereas reducer is optional.
10
85
  * The ActionType must have properties as strings and values as arrays.
11
86
  *
12
87
  * @HandlingActions Reducers can be added through constructor or using Store.on('action', reducer) or Store.once('action', reducer).
@@ -26,7 +101,7 @@ class Store<
26
101
  { [Action in keyof ActionTypes]: Array<Reducer<State, ActionTypes, Action>> } =
27
102
  { [Action in keyof ActionTypes]: Array<Reducer<State, ActionTypes, Action>> }
28
103
  > extends EventEmitter<Record<keyof Actions, ActionTypes[keyof ActionTypes]> & Record<'stateChange', [previous: State, current: State]>> {
29
- constructor(state: State, actions: { [Action in keyof ActionTypes]?: Arrayable<Reducer<State, ActionTypes, Action>> } = {});
104
+ constructor(state: State, actions?: { [Action in keyof ActionTypes]?: Arrayable<Reducer<State, ActionTypes, Action>> });
30
105
 
31
106
  private _state: State;
32
107
  public get state(): State;