@rsdk/common 0.14.0

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 (143) hide show
  1. package/.eslintignore +4 -0
  2. package/.eslintrc.js +4 -0
  3. package/.prettierignore +1 -0
  4. package/.prettierrc.json +1 -0
  5. package/dist/convert/convert.class.d.ts +61 -0
  6. package/dist/convert/convert.class.js +144 -0
  7. package/dist/convert/convert.class.js.map +1 -0
  8. package/dist/convert/index.d.ts +1 -0
  9. package/dist/convert/index.js +18 -0
  10. package/dist/convert/index.js.map +1 -0
  11. package/dist/enums/enums.functions.d.ts +15 -0
  12. package/dist/enums/enums.functions.js +31 -0
  13. package/dist/enums/enums.functions.js.map +1 -0
  14. package/dist/enums/index.d.ts +2 -0
  15. package/dist/enums/index.js +19 -0
  16. package/dist/enums/index.js.map +1 -0
  17. package/dist/enums/types.d.ts +4 -0
  18. package/dist/enums/types.js +3 -0
  19. package/dist/enums/types.js.map +1 -0
  20. package/dist/functions/index.d.ts +2 -0
  21. package/dist/functions/index.js +19 -0
  22. package/dist/functions/index.js.map +1 -0
  23. package/dist/functions/misc.d.ts +33 -0
  24. package/dist/functions/misc.js +57 -0
  25. package/dist/functions/misc.js.map +1 -0
  26. package/dist/functions/obj-normalization.d.ts +27 -0
  27. package/dist/functions/obj-normalization.js +73 -0
  28. package/dist/functions/obj-normalization.js.map +1 -0
  29. package/dist/index.d.ts +8 -0
  30. package/dist/index.js +38 -0
  31. package/dist/index.js.map +1 -0
  32. package/dist/serialization/errors/index.d.ts +3 -0
  33. package/dist/serialization/errors/index.js +20 -0
  34. package/dist/serialization/errors/index.js.map +1 -0
  35. package/dist/serialization/errors/not-absolute-path.error.d.ts +3 -0
  36. package/dist/serialization/errors/not-absolute-path.error.js +10 -0
  37. package/dist/serialization/errors/not-absolute-path.error.js.map +1 -0
  38. package/dist/serialization/errors/unknown-file-ext.error.d.ts +3 -0
  39. package/dist/serialization/errors/unknown-file-ext.error.js +10 -0
  40. package/dist/serialization/errors/unknown-file-ext.error.js.map +1 -0
  41. package/dist/serialization/errors/unknown-format.error.d.ts +5 -0
  42. package/dist/serialization/errors/unknown-format.error.js +11 -0
  43. package/dist/serialization/errors/unknown-format.error.js.map +1 -0
  44. package/dist/serialization/index.d.ts +5 -0
  45. package/dist/serialization/index.js +22 -0
  46. package/dist/serialization/index.js.map +1 -0
  47. package/dist/serialization/read-obj-sync.d.ts +9 -0
  48. package/dist/serialization/read-obj-sync.js +25 -0
  49. package/dist/serialization/read-obj-sync.js.map +1 -0
  50. package/dist/serialization/read-obj.d.ts +8 -0
  51. package/dist/serialization/read-obj.js +24 -0
  52. package/dist/serialization/read-obj.js.map +1 -0
  53. package/dist/serialization/reviving-serializer.d.ts +8 -0
  54. package/dist/serialization/reviving-serializer.js +30 -0
  55. package/dist/serialization/reviving-serializer.js.map +1 -0
  56. package/dist/serialization/save-obj.d.ts +10 -0
  57. package/dist/serialization/save-obj.js +25 -0
  58. package/dist/serialization/save-obj.js.map +1 -0
  59. package/dist/serialization/serializer.class.d.ts +14 -0
  60. package/dist/serialization/serializer.class.js +64 -0
  61. package/dist/serialization/serializer.class.js.map +1 -0
  62. package/dist/size/index.d.ts +1 -0
  63. package/dist/size/index.js +18 -0
  64. package/dist/size/index.js.map +1 -0
  65. package/dist/size/size.class.d.ts +16 -0
  66. package/dist/size/size.class.js +60 -0
  67. package/dist/size/size.class.js.map +1 -0
  68. package/dist/time/index.d.ts +4 -0
  69. package/dist/time/index.js +21 -0
  70. package/dist/time/index.js.map +1 -0
  71. package/dist/time/repeat.fn.d.ts +8 -0
  72. package/dist/time/repeat.fn.js +23 -0
  73. package/dist/time/repeat.fn.js.map +1 -0
  74. package/dist/time/stopwatch.class.d.ts +61 -0
  75. package/dist/time/stopwatch.class.js +97 -0
  76. package/dist/time/stopwatch.class.js.map +1 -0
  77. package/dist/time/timer.class.d.ts +9 -0
  78. package/dist/time/timer.class.js +18 -0
  79. package/dist/time/timer.class.js.map +1 -0
  80. package/dist/time/timespan.class.d.ts +49 -0
  81. package/dist/time/timespan.class.js +116 -0
  82. package/dist/time/timespan.class.js.map +1 -0
  83. package/dist/tsconfig.tsbuildinfo +1 -0
  84. package/dist/types/assert.class.d.ts +5 -0
  85. package/dist/types/assert.class.js +25 -0
  86. package/dist/types/assert.class.js.map +1 -0
  87. package/dist/types/constructor.type.d.ts +2 -0
  88. package/dist/types/constructor.type.js +3 -0
  89. package/dist/types/constructor.type.js.map +1 -0
  90. package/dist/types/deep-partial.type.d.ts +11 -0
  91. package/dist/types/deep-partial.type.js +3 -0
  92. package/dist/types/deep-partial.type.js.map +1 -0
  93. package/dist/types/error-like.type.d.ts +5 -0
  94. package/dist/types/error-like.type.js +6 -0
  95. package/dist/types/error-like.type.js.map +1 -0
  96. package/dist/types/index.d.ts +6 -0
  97. package/dist/types/index.js +22 -0
  98. package/dist/types/index.js.map +1 -0
  99. package/dist/types/primitive.type.d.ts +2 -0
  100. package/dist/types/primitive.type.js +6 -0
  101. package/dist/types/primitive.type.js.map +1 -0
  102. package/dist/types/required-fields.d.ts +5 -0
  103. package/dist/types/required-fields.js +3 -0
  104. package/dist/types/required-fields.js.map +1 -0
  105. package/package.json +32 -0
  106. package/src/convert/convert.class.ts +172 -0
  107. package/src/convert/convert.spec.ts +271 -0
  108. package/src/convert/index.ts +1 -0
  109. package/src/enums/enums.functions.ts +34 -0
  110. package/src/enums/enums.spec.ts +59 -0
  111. package/src/enums/index.ts +2 -0
  112. package/src/enums/types.ts +5 -0
  113. package/src/functions/index.ts +2 -0
  114. package/src/functions/misc.ts +70 -0
  115. package/src/functions/obj-normalization.ts +104 -0
  116. package/src/index.ts +8 -0
  117. package/src/serialization/errors/index.ts +3 -0
  118. package/src/serialization/errors/not-absolute-path.error.ts +5 -0
  119. package/src/serialization/errors/unknown-file-ext.error.ts +5 -0
  120. package/src/serialization/errors/unknown-format.error.ts +9 -0
  121. package/src/serialization/index.ts +5 -0
  122. package/src/serialization/read-obj-sync.ts +24 -0
  123. package/src/serialization/read-obj.ts +23 -0
  124. package/src/serialization/reviving-serializer.ts +32 -0
  125. package/src/serialization/save-obj.ts +31 -0
  126. package/src/serialization/serializer.class.ts +85 -0
  127. package/src/size/index.ts +1 -0
  128. package/src/size/size.class.ts +77 -0
  129. package/src/size/size.spec.ts +74 -0
  130. package/src/time/index.ts +4 -0
  131. package/src/time/repeat.fn.ts +27 -0
  132. package/src/time/stopwatch.class.ts +108 -0
  133. package/src/time/timer.class.ts +15 -0
  134. package/src/time/timespan.class.ts +161 -0
  135. package/src/time/timespan.spec.ts +81 -0
  136. package/src/types/assert.class.ts +25 -0
  137. package/src/types/constructor.type.ts +2 -0
  138. package/src/types/deep-partial.type.ts +23 -0
  139. package/src/types/error-like.type.ts +8 -0
  140. package/src/types/index.ts +6 -0
  141. package/src/types/primitive.type.ts +4 -0
  142. package/src/types/required-fields.ts +8 -0
  143. package/tsconfig.json +16 -0
package/.eslintignore ADDED
@@ -0,0 +1,4 @@
1
+ libs/contract
2
+ **/*.d.ts
3
+ **/*.js
4
+ **/generated
package/.eslintrc.js ADDED
@@ -0,0 +1,4 @@
1
+ module.exports = {
2
+ root: true,
3
+ extends: ["rsdk"],
4
+ };
@@ -0,0 +1 @@
1
+ **/*.spec.ts
@@ -0,0 +1 @@
1
+ "@rsdk/prettier-config"
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Need to use any due to low-level dynamic operations.
3
+ */
4
+ import type { EnumLike } from '../enums';
5
+ /**
6
+ * Static class which provides some conversion methods.
7
+ *
8
+ * @export
9
+ * @class Convert
10
+ */
11
+ export declare class Convert {
12
+ /**
13
+ * Converts any value to int or throws error. Accepts values in decimal or
14
+ * hexadecimal format (prefixed with 0x). Signed and unsigned
15
+ *
16
+ * @static
17
+ * @param {*} value Any input value.
18
+ * @returns {number}
19
+ * @throws {Error} Throws if conversion is impossible.
20
+ * @memberof Convert
21
+ */
22
+ static int(value: unknown): number;
23
+ /**
24
+ * Converts any value to number or throws error. Decimal separator
25
+ * depends on machine locale
26
+ *
27
+ * @static
28
+ * @param {*} value Any input value.
29
+ * @returns {number}
30
+ * @throws {Error} Throws if conversion is impossible.
31
+ * @memberof Convert
32
+ */
33
+ static number(value: unknown): number;
34
+ /**
35
+ * Converts any value to boolean or throws error.
36
+ * Only boolean values or strings 'true' and 'false' (case insensitive) can be converted.
37
+ *
38
+ * @static
39
+ * @param {*} value Any input value.
40
+ * @param {number} [defaultValue] Value to use if input value is undefined.
41
+ * @returns {number}
42
+ * @throws {Error} Throws if conversion is impossible.
43
+ * @memberof Convert
44
+ */
45
+ static boolean(value: unknown): boolean;
46
+ /**
47
+ * Converts unknown value to member of specified enum or throws error.
48
+ *
49
+ * @static
50
+ * @param {*} value Unknown input value.
51
+ * @returns {E}
52
+ * @throws {Error} Throws if conversion is impossible.
53
+ * @memberof Convert
54
+ */
55
+ static enum<E>(value: unknown, e: EnumLike): E;
56
+ private static numberError;
57
+ private static intError;
58
+ private static booleanError;
59
+ private static wrapIfString;
60
+ private static enumError;
61
+ }
@@ -0,0 +1,144 @@
1
+ "use strict";
2
+ /* eslint-disable max-classes-per-file */
3
+ /**
4
+ * Need to use any due to low-level dynamic operations.
5
+ */
6
+ /* eslint-disable @typescript-eslint/no-explicit-any */
7
+ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.Convert = void 0;
10
+ const enums_1 = require("../enums");
11
+ /**
12
+ * Static class which provides some conversion methods.
13
+ *
14
+ * @export
15
+ * @class Convert
16
+ */
17
+ class Convert {
18
+ /**
19
+ * Converts any value to int or throws error. Accepts values in decimal or
20
+ * hexadecimal format (prefixed with 0x). Signed and unsigned
21
+ *
22
+ * @static
23
+ * @param {*} value Any input value.
24
+ * @returns {number}
25
+ * @throws {Error} Throws if conversion is impossible.
26
+ * @memberof Convert
27
+ */
28
+ static int(value) {
29
+ if (typeof value !== 'string' && typeof value !== 'number') {
30
+ throw this.intError(value);
31
+ }
32
+ if (value === '') {
33
+ throw this.intError(value);
34
+ }
35
+ // Why not parseInt, because parseInt(123,2) === 123;
36
+ const parsed = +value;
37
+ if (!Number.isInteger(parsed)) {
38
+ throw this.intError(value);
39
+ }
40
+ return parsed;
41
+ }
42
+ /**
43
+ * Converts any value to number or throws error. Decimal separator
44
+ * depends on machine locale
45
+ *
46
+ * @static
47
+ * @param {*} value Any input value.
48
+ * @returns {number}
49
+ * @throws {Error} Throws if conversion is impossible.
50
+ * @memberof Convert
51
+ */
52
+ static number(value) {
53
+ if (typeof value !== 'string' && typeof value !== 'number') {
54
+ throw this.numberError(value);
55
+ }
56
+ if (value === '') {
57
+ throw this.numberError(value);
58
+ }
59
+ // See comments to int() method
60
+ const parsed = +value;
61
+ if (Number.isNaN(parsed)) {
62
+ throw this.numberError(value);
63
+ }
64
+ return parsed;
65
+ }
66
+ /**
67
+ * Converts any value to boolean or throws error.
68
+ * Only boolean values or strings 'true' and 'false' (case insensitive) can be converted.
69
+ *
70
+ * @static
71
+ * @param {*} value Any input value.
72
+ * @param {number} [defaultValue] Value to use if input value is undefined.
73
+ * @returns {number}
74
+ * @throws {Error} Throws if conversion is impossible.
75
+ * @memberof Convert
76
+ */
77
+ static boolean(value) {
78
+ if (typeof value !== 'string' && typeof value !== 'boolean') {
79
+ throw this.booleanError(value);
80
+ }
81
+ if (typeof value === 'boolean') {
82
+ return value;
83
+ }
84
+ const normalized = value.toLowerCase().trim();
85
+ if (!['true', 'false'].includes(normalized)) {
86
+ throw this.booleanError(value);
87
+ }
88
+ return normalized === 'true';
89
+ }
90
+ /**
91
+ * Converts unknown value to member of specified enum or throws error.
92
+ *
93
+ * @static
94
+ * @param {*} value Unknown input value.
95
+ * @returns {E}
96
+ * @throws {Error} Throws if conversion is impossible.
97
+ * @memberof Convert
98
+ */
99
+ static enum(value, e) {
100
+ if (typeof value !== 'string' && typeof value !== 'number') {
101
+ throw this.enumError(value, e);
102
+ }
103
+ for (const v of enums_1.Enum.values(e)) {
104
+ const trimmed = typeof value === 'string' ? value.trim() : value;
105
+ if (v === trimmed) {
106
+ return value;
107
+ }
108
+ if (typeof v === 'number' &&
109
+ typeof value !== 'number' &&
110
+ v === parseInt(value, 10)) {
111
+ return v;
112
+ }
113
+ }
114
+ const result = e[value];
115
+ if (result === undefined) {
116
+ throw this.enumError(value, e);
117
+ }
118
+ return result;
119
+ }
120
+ static numberError(value) {
121
+ return new Error(`Value <${value}> can't be converted to number.`);
122
+ }
123
+ static intError(value) {
124
+ return new Error(`Value <${value}> can't be converted to integer.`);
125
+ }
126
+ static booleanError(value) {
127
+ return new Error(`Value <${value}> can't be converted to boolean.`);
128
+ }
129
+ static wrapIfString(value) {
130
+ return typeof value === 'string'
131
+ ? `'${value}'`
132
+ : // We use String(...) here because null or undefined doesn't
133
+ // have toString() method
134
+ String(value);
135
+ }
136
+ static enumError(value, e) {
137
+ return new Error(`<${this.wrapIfString(value)}> is not member of enum: <${enums_1.Enum.values(e)
138
+ .map(this.wrapIfString)
139
+ .join(', ')}>
140
+ `);
141
+ }
142
+ }
143
+ exports.Convert = Convert;
144
+ //# sourceMappingURL=convert.class.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convert.class.js","sourceRoot":"","sources":["../../src/convert/convert.class.ts"],"names":[],"mappings":";AAAA,yCAAyC;AACzC;;GAEG;AACH,uDAAuD;AACvD,sEAAsE;;;AAGtE,oCAAgC;AAEhC;;;;;GAKG;AACH,MAAa,OAAO;IAClB;;;;;;;;;OASG;IACH,MAAM,CAAC,GAAG,CAAC,KAAc;QACvB,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YAC1D,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;SAC5B;QAED,IAAI,KAAK,KAAK,EAAE,EAAE;YAChB,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;SAC5B;QAED,qDAAqD;QACrD,MAAM,MAAM,GAAG,CAAC,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AAC,IAAI,KAAK,GAAG;YACd,CAAC,CAAC,4DAA4D;gBAC5D,yBAAyB;gBACzB,MAAM,CAAC,KAAK,CAAC,CAAC;IACpB,CAAC;IAEO,MAAM,CAAC,SAAS,CAAC,KAAU,EAAE,CAAW;QAC9C,OAAO,IAAI,KAAK,CAAC,IAAI,IAAI,CAAC,YAAY,CACpC,KAAK,CACN,6BAA6B,YAAI,CAAC,MAAM,CAAC,CAAC,CAAC;aACzC,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC;aACtB,IAAI,CAAC,IAAI,CAAC;KACZ,CAAC,CAAC;IACL,CAAC;CACF;AA3JD,0BA2JC"}
@@ -0,0 +1 @@
1
+ export * from './convert.class';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
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);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./convert.class"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/convert/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC"}
@@ -0,0 +1,15 @@
1
+ import type { EnumLike, EnumValue } from './types';
2
+ /**
3
+ * Easy get keys or values of any typescript enum.
4
+ * Works with numeric, strings or mixed enums.
5
+ */
6
+ export declare class Enum {
7
+ /**
8
+ * Get keys of enum (string[])
9
+ */
10
+ static keys(e: EnumLike): string[];
11
+ /**
12
+ * Get values of enum ((string | number)[])
13
+ */
14
+ static values(e: EnumLike): EnumValue[];
15
+ }
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Enum = void 0;
4
+ const enumMembers = (e, get) => {
5
+ const numeric = Object.values(e)
6
+ .filter((v) => typeof v === 'number')
7
+ .map((n) => `${n}`);
8
+ return Object.entries(e)
9
+ .filter(([key]) => !numeric.includes(key))
10
+ .map((pair) => pair[get === 'keys' ? 0 : 1]);
11
+ };
12
+ /**
13
+ * Easy get keys or values of any typescript enum.
14
+ * Works with numeric, strings or mixed enums.
15
+ */
16
+ class Enum {
17
+ /**
18
+ * Get keys of enum (string[])
19
+ */
20
+ static keys(e) {
21
+ return enumMembers(e, 'keys');
22
+ }
23
+ /**
24
+ * Get values of enum ((string | number)[])
25
+ */
26
+ static values(e) {
27
+ return enumMembers(e, 'values');
28
+ }
29
+ }
30
+ exports.Enum = Enum;
31
+ //# sourceMappingURL=enums.functions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enums.functions.js","sourceRoot":"","sources":["../../src/enums/enums.functions.ts"],"names":[],"mappings":";;;AAEA,MAAM,WAAW,GAAG,CAClB,CAAW,EACX,GAAsB,EACD,EAAE;IACvB,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;SAC7B,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC;SACpC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAEtB,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;SACrB,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;SACzC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAoB,CAAC,CAAC;AACpE,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAa,IAAI;IACf;;OAEG;IACH,MAAM,CAAC,IAAI,CAAC,CAAW;QACrB,OAAO,WAAW,CAAC,CAAC,EAAE,MAAM,CAAa,CAAC;IAC5C,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,MAAM,CAAC,CAAW;QACvB,OAAO,WAAW,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;IAClC,CAAC;CACF;AAdD,oBAcC"}
@@ -0,0 +1,2 @@
1
+ export * from './enums.functions';
2
+ export * from './types';
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
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);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./enums.functions"), exports);
18
+ __exportStar(require("./types"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/enums/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,0CAAwB"}
@@ -0,0 +1,4 @@
1
+ export type EnumValue = string | number;
2
+ export interface EnumLike {
3
+ [key: string]: string | number;
4
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/enums/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export * from './misc';
2
+ export * from './obj-normalization';
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
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);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./misc"), exports);
18
+ __exportStar(require("./obj-normalization"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/functions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAuB;AACvB,sDAAoC"}
@@ -0,0 +1,33 @@
1
+ import type { PathLike } from 'fs';
2
+ import type { Readable } from 'stream';
3
+ import type { Constructor } from '../types';
4
+ /**
5
+ * Helps to create multi-line string literals in code. All double spaces and
6
+ * line breaks will be trimmed to single space (just like HTML)
7
+ * @example text`
8
+ * Some multi-line
9
+ * literal!
10
+ * `
11
+ * will produce just "Some multi-line literal"
12
+ */
13
+ export declare const text: (mainParts: TemplateStringsArray, ...intermediateParts: unknown[]) => string;
14
+ /**
15
+ * Helps to create exaustive switch/case
16
+ * Example:
17
+ *
18
+ * switch (c: Color) {
19
+ * case Color.Red: return 'red';
20
+ * case Color.Green: return 'green';
21
+ * default: unreachable(c)
22
+ * }
23
+ */
24
+ export declare const unreachable: (_value: never) => any;
25
+ /**
26
+ * Writes contents of readable stream to file
27
+ */
28
+ export declare const streamWriteFile: (stream: Readable, path: PathLike) => Promise<void>;
29
+ export declare const isRecord: (x: unknown) => x is Record<string, unknown>;
30
+ export declare const isUndefined: <T>(value: T | undefined) => value is T;
31
+ export declare const hasKey: <T extends object>(obj: T, key: keyof T) => boolean;
32
+ export declare const isOneOf: (value: unknown, types: Constructor[]) => boolean;
33
+ export declare const noop: () => void;
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.noop = exports.isOneOf = exports.hasKey = exports.isUndefined = exports.isRecord = exports.streamWriteFile = exports.unreachable = exports.text = void 0;
4
+ const fs_1 = require("fs");
5
+ /**
6
+ * Helps to create multi-line string literals in code. All double spaces and
7
+ * line breaks will be trimmed to single space (just like HTML)
8
+ * @example text`
9
+ * Some multi-line
10
+ * literal!
11
+ * `
12
+ * will produce just "Some multi-line literal"
13
+ */
14
+ const text = (mainParts, ...intermediateParts) => {
15
+ const textWithSpaces = String.raw(mainParts, ...intermediateParts);
16
+ if (!textWithSpaces) {
17
+ return textWithSpaces;
18
+ }
19
+ return textWithSpaces.trim().replace(/\s+/g, ' ');
20
+ };
21
+ exports.text = text;
22
+ /**
23
+ * Helps to create exaustive switch/case
24
+ * Example:
25
+ *
26
+ * switch (c: Color) {
27
+ * case Color.Red: return 'red';
28
+ * case Color.Green: return 'green';
29
+ * default: unreachable(c)
30
+ * }
31
+ */
32
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function
33
+ const unreachable = (_value) => { };
34
+ exports.unreachable = unreachable;
35
+ /**
36
+ * Writes contents of readable stream to file
37
+ */
38
+ const streamWriteFile = (stream, path) => {
39
+ return new Promise((resolve, reject) => {
40
+ stream.pipe((0, fs_1.createWriteStream)(path));
41
+ stream.once('error', reject);
42
+ stream.once('end', resolve);
43
+ });
44
+ };
45
+ exports.streamWriteFile = streamWriteFile;
46
+ const isRecord = (x) => typeof x === 'object' && !Array.isArray(x) && x !== null;
47
+ exports.isRecord = isRecord;
48
+ const isUndefined = (value) => value === undefined;
49
+ exports.isUndefined = isUndefined;
50
+ const hasKey = (obj, key) => key in obj;
51
+ exports.hasKey = hasKey;
52
+ const isOneOf = (value, types) => types.some((Type) => value instanceof Type);
53
+ exports.isOneOf = isOneOf;
54
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
55
+ const noop = () => { };
56
+ exports.noop = noop;
57
+ //# sourceMappingURL=misc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"misc.js","sourceRoot":"","sources":["../../src/functions/misc.ts"],"names":[],"mappings":";;;AAAA,2BAAuC;AAOvC;;;;;;;;GAQG;AACI,MAAM,IAAI,GAAG,CAClB,SAA+B,EAC/B,GAAG,iBAA4B,EACvB,EAAE;IACV,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE,GAAG,iBAAiB,CAAC,CAAC;IAEnE,IAAI,CAAC,cAAc,EAAE;QACnB,OAAO,cAAc,CAAC;KACvB;IAED,OAAO,cAAc,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AACpD,CAAC,CAAC;AAXW,QAAA,IAAI,QAWf;AAEF;;;;;;;;;GASG;AACH,mGAAmG;AAC5F,MAAM,WAAW,GAAG,CAAC,MAAa,EAAO,EAAE,GAAE,CAAC,CAAC;AAAzC,QAAA,WAAW,eAA8B;AAEtD;;GAEG;AACI,MAAM,eAAe,GAAG,CAC7B,MAAgB,EAChB,IAAc,EACC,EAAE;IACjB,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC3C,MAAM,CAAC,IAAI,CAAC,IAAA,sBAAiB,EAAC,IAAI,CAAC,CAAC,CAAC;QACrC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC7B,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC9B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AATW,QAAA,eAAe,mBAS1B;AAEK,MAAM,QAAQ,GAAG,CAAC,CAAU,EAAgC,EAAE,CACnE,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC;AAD9C,QAAA,QAAQ,YACsC;AAEpD,MAAM,WAAW,GAAG,CAAI,KAAoB,EAAc,EAAE,CACjE,KAAK,KAAK,SAAS,CAAC;AADT,QAAA,WAAW,eACF;AAEf,MAAM,MAAM,GAAG,CAAmB,GAAM,EAAE,GAAY,EAAW,EAAE,CACxE,GAAG,IAAI,GAAG,CAAC;AADA,QAAA,MAAM,UACN;AAEN,MAAM,OAAO,GAAG,CAAC,KAAc,EAAE,KAAoB,EAAW,EAAE,CACvE,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,YAAY,IAAI,CAAC,CAAC;AADjC,QAAA,OAAO,WAC0B;AAE9C,gEAAgE;AACzD,MAAM,IAAI,GAAG,GAAS,EAAE,GAAE,CAAC,CAAC;AAAtB,QAAA,IAAI,QAAkB"}
@@ -0,0 +1,27 @@
1
+ export interface SortKeys {
2
+ match: (x: unknown) => boolean;
3
+ sortFn: (a: string, b: string) => number;
4
+ }
5
+ export interface NormalizeOptions {
6
+ filterKeys?: string[];
7
+ sortKeys?: SortKeys;
8
+ maxDepth?: number;
9
+ }
10
+ /**
11
+ * Prepares object to be stringified with JSON.stringify()
12
+ * - removes circular references.
13
+ * - makes message, stack and cause properties of Errors enumerable
14
+ * - (optional) sorts error keys for human readability
15
+ * - (optional) filters out provided keys
16
+ *
17
+ * NOTE: Function is recursive
18
+ *
19
+ * @param x any value,
20
+ * @param options NormalizeOptions
21
+ * @returns unknown
22
+ */
23
+ export declare const normalizer: () => (x: unknown, options?: NormalizeOptions, depth?: number) => unknown;
24
+ /**
25
+ * SortOptions for keys of Error instances
26
+ */
27
+ export declare const sortErrorKeys: SortKeys;
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sortErrorKeys = exports.normalizer = void 0;
4
+ const types_1 = require("../types");
5
+ const DEFAULT_MAX_DEPTH = 10;
6
+ /**
7
+ * Prepares object to be stringified with JSON.stringify()
8
+ * - removes circular references.
9
+ * - makes message, stack and cause properties of Errors enumerable
10
+ * - (optional) sorts error keys for human readability
11
+ * - (optional) filters out provided keys
12
+ *
13
+ * NOTE: Function is recursive
14
+ *
15
+ * @param x any value,
16
+ * @param options NormalizeOptions
17
+ * @returns unknown
18
+ */
19
+ const normalizer = () => {
20
+ const cache = new Set();
21
+ const normalize = (x, options, depth = 0) => {
22
+ if (x === null || x === undefined || (0, types_1.isPrimitive)(x)) {
23
+ return x;
24
+ }
25
+ if (cache.has(x)) {
26
+ return '[circular]';
27
+ }
28
+ else {
29
+ cache.add(x);
30
+ }
31
+ if (Array.isArray(x)) {
32
+ return x.map((x) => normalize(x, options));
33
+ }
34
+ if (depth >= (options?.maxDepth ?? DEFAULT_MAX_DEPTH)) {
35
+ return '[max nesting depth reached]';
36
+ }
37
+ const unique = new Set(Object.keys(x));
38
+ if (x instanceof Error) {
39
+ unique.add('cause');
40
+ unique.add('stack');
41
+ unique.add('message');
42
+ }
43
+ const keys = [...unique];
44
+ if (options?.sortKeys && options.sortKeys.match(x)) {
45
+ keys.sort(options.sortKeys.sortFn);
46
+ }
47
+ const newDepth = depth + 1;
48
+ return keys.reduce((acc, key) => {
49
+ if (options?.filterKeys && options.filterKeys.includes(key)) {
50
+ return acc;
51
+ }
52
+ acc[key] = normalize(x[key], options, newDepth);
53
+ return acc;
54
+ }, {});
55
+ };
56
+ return normalize;
57
+ };
58
+ exports.normalizer = normalizer;
59
+ const errorKeysOrder = new Map()
60
+ .set('metatype', 0)
61
+ .set('code', 1)
62
+ .set('message', 2)
63
+ .set('details', 3)
64
+ .set('stack', 4)
65
+ .set('cause', 5);
66
+ /**
67
+ * SortOptions for keys of Error instances
68
+ */
69
+ exports.sortErrorKeys = {
70
+ match: (x) => x instanceof Error,
71
+ sortFn: (a, b) => (errorKeysOrder.get(a) ?? 0) > (errorKeysOrder.get(b) ?? 0) ? 1 : -1,
72
+ };
73
+ //# sourceMappingURL=obj-normalization.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"obj-normalization.js","sourceRoot":"","sources":["../../src/functions/obj-normalization.ts"],"names":[],"mappings":";;;AAAA,oCAAuC;AAavC,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAE7B;;;;;;;;;;;;GAYG;AACI,MAAM,UAAU,GAAG,GAIZ,EAAE;IACd,MAAM,KAAK,GAAG,IAAI,GAAG,EAAE,CAAC;IAExB,MAAM,SAAS,GAAG,CAChB,CAAU,EACV,OAA0B,EAC1B,KAAK,GAAG,CAAC,EACA,EAAE;QACX,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,SAAS,IAAI,IAAA,mBAAW,EAAC,CAAC,CAAC,EAAE;YACnD,OAAO,CAAC,CAAC;SACV;QAED,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;YAChB,OAAO,YAAY,CAAC;SACrB;aAAM;YACL,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;SACd;QAED,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;YACpB,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;SAC5C;QAED,I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C;KACd,GAAG,CAAC,SAAS,EAAE,CAAC,CAAC;KACjB,GAAG,CAAC,SAAS,EAAE,CAAC,CAAC;KACjB,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;KACf,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;AAEnB;;GAEG;AACU,QAAA,aAAa,GAAa;IACrC,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,YAAY,KAAK;IAChC,MAAM,EAAE,CAAC,CAAS,EAAE,CAAS,EAAU,EAAE,CACvC,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CACvE,CAAC"}
@@ -0,0 +1,8 @@
1
+ export * as dotenv from 'dotenv';
2
+ export * from './types';
3
+ export * from './enums';
4
+ export * from './convert';
5
+ export * from './time';
6
+ export * from './serialization';
7
+ export * from './functions';
8
+ export * from './size';
package/dist/index.js ADDED
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
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;
24
+ };
25
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
26
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.dotenv = void 0;
30
+ exports.dotenv = __importStar(require("dotenv"));
31
+ __exportStar(require("./types"), exports);
32
+ __exportStar(require("./enums"), exports);
33
+ __exportStar(require("./convert"), exports);
34
+ __exportStar(require("./time"), exports);
35
+ __exportStar(require("./serialization"), exports);
36
+ __exportStar(require("./functions"), exports);
37
+ __exportStar(require("./size"), exports);
38
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAiC;AACjC,0CAAwB;AACxB,0CAAwB;AACxB,4CAA0B;AAC1B,yCAAuB;AACvB,kDAAgC;AAChC,8CAA4B;AAC5B,yCAAuB"}
@@ -0,0 +1,3 @@
1
+ export * from './not-absolute-path.error';
2
+ export * from './unknown-file-ext.error';
3
+ export * from './unknown-format.error';