@hichchi/utils 0.0.1-alpha.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.
@@ -0,0 +1,217 @@
1
+ /**
2
+ * Break a string into words array.<br>
3
+ *
4
+ * This function will break any of below to words in examples into `['hello', 'world']`<br>
5
+ *
6
+ * @param {string} str String to break into words.
7
+ * @returns {string[]} Array of words.
8
+ *
9
+ * @example
10
+ * ```TypeScript
11
+ * breakToWords("helloWorld"); // ['hello', 'world']
12
+ * ```
13
+ *
14
+ * @example
15
+ * ```TypeScript
16
+ * breakToWords("hello_world"); // ['hello', 'world']
17
+ * ```
18
+ *
19
+ * @example
20
+ * ```TypeScript
21
+ * breakToWords("hello-world"); // ['hello', 'world']
22
+ * ```
23
+ *
24
+ * @example
25
+ * ```TypeScript
26
+ * breakToWords("hello world"); // ['hello', 'world']
27
+ * ```
28
+ */
29
+ export declare function breakToWords(str: string): string[];
30
+ /**
31
+ * Break a string into words array and format the string.<br>
32
+ *
33
+ * This function will break string into words and format the string using the provided function.<br>
34
+ *
35
+ * @param {string} str String to break into words.
36
+ * @param {() => string} format Formatting function.
37
+ * @returns {string} Formatted string.
38
+ *
39
+ * @example
40
+ * ```TypeScript
41
+ * breakToWords("helloWorld" , toFirstCase); // Hello world
42
+ * ```
43
+ */
44
+ export declare function breakToWords(str: string, format: (str: string) => string): string;
45
+ /**
46
+ * Convert a string to lower case.
47
+ * @param {string} [str] String to convert to lower case.
48
+ * @returns {string} String in lower case.
49
+ *
50
+ * @example
51
+ * ```TypeScript
52
+ * toLowerCase("Hello World"); // "hello world"
53
+ * ```
54
+ */
55
+ export declare function toLowerCase(str?: string): string;
56
+ /**
57
+ * Convert a string to lower cases and break into words with optional join or space.
58
+ * @param {string} [str] String to convert to lower cases and break into words.
59
+ * @param {string} [join] Optional string to join the words with.
60
+ * @returns {string} String in lower cases and broken into words.
61
+ *
62
+ * @example
63
+ * ```TypeScript
64
+ * toLowerCaseBreak("HelloWorld"); // "hello world"
65
+ * ```
66
+ */
67
+ export declare function toLowerCaseBreak(str?: string, join?: string): string;
68
+ /**
69
+ * Convert a string to upper case.
70
+ * @param {string} [str] String to convert to upper case.
71
+ * @returns {string} String in upper case.
72
+ *
73
+ * @example
74
+ * ```TypeScript
75
+ * toUpperCase("HelloWorld"); // "HELLO WORLD"
76
+ * ```
77
+ */
78
+ export declare function toUpperCase(str?: string): string;
79
+ /**
80
+ * Convert a string to upper cases and break into words with optional join or space.
81
+ * @param {string} [str] String to convert to upper cases and break into words.
82
+ * @param {string} [join] Optional string to join the words with.
83
+ * @returns {string} String in upper cases and broken into words.
84
+ *
85
+ * @example
86
+ * ```TypeScript
87
+ * toUpperCaseBreak("HelloWorld"); // "HELLO WORLD"
88
+ * ```
89
+ *
90
+ * @example
91
+ * ```TypeScript
92
+ * toUpperCaseBreak("HelloWorld", "! "); // "HELLO! WORLD"
93
+ */
94
+ export declare function toUpperCaseBreak(str?: string, join?: string): string;
95
+ /**
96
+ * Convert a string to first case (Capitalize first letter of the string).
97
+ * @param {string} [str] Optional string to join the words with.
98
+ * @returns {string} String in first case.
99
+ *
100
+ * @example
101
+ * ```TypeScript
102
+ * toFirstCase("hello world"); // "Hello world"
103
+ * ```
104
+ */
105
+ export declare function toFirstCase(str?: string): string;
106
+ export declare function toFirstCaseBreak(str?: string, join?: string): string;
107
+ /**
108
+ * Convert a string to title case (Capitalize first letter of each word).
109
+ * @param {string} [str] String to convert to title case.
110
+ * @returns {string} String in title case.
111
+ *
112
+ * @example
113
+ * ```TypeScript
114
+ * toTitleCase("hello world"); // "Hello World"
115
+ * ```
116
+ */
117
+ export declare function toTitleCase(str?: string): string;
118
+ /**
119
+ * Convert a string to camel case.
120
+ * @param {string} [str] String to convert to camel case.
121
+ * @returns {string} String in camel case.
122
+ *
123
+ * @example
124
+ * ```TypeScript
125
+ * toCamelCase("hello world"); // "helloWorld"
126
+ * ```
127
+ */
128
+ export declare function toCamelCase(str?: string): string;
129
+ /**
130
+ * Convert a string to pascal case.
131
+ * @param {string} [str] String to convert to pascal case.
132
+ * @returns {string} String in pascal case.
133
+ *
134
+ * @example
135
+ * ```TypeScript
136
+ * toPascalCase("hello world"); // "HelloWorld"
137
+ * ```
138
+ */
139
+ export declare function toPascalCase(str?: string): string;
140
+ /**
141
+ * Convert a string to sentence case. (Capitalize first letter of every sentence).
142
+ * @param {string} [str] String to convert to sentence case.
143
+ * @returns {string} String in sentence case.
144
+ *
145
+ * @example
146
+ * ```TypeScript
147
+ * toSentenceCase("hello world. how are you?"); // "Hello world. How are you?"
148
+ * ```
149
+ */
150
+ export declare function toSentenceCase(str: string): string;
151
+ /**
152
+ * Convert a string to snake case.
153
+ * @param {string} [str] String to convert to snake case.
154
+ * @param {boolean} [caps] Whether to convert to upper case.
155
+ * @returns {string} String in snake case.
156
+ *
157
+ * @example
158
+ * ```TypeScript
159
+ * toSnakeCase("hello world"); // "hello_world"
160
+ *```
161
+ *
162
+ * @example
163
+ * ```TypeScript
164
+ * toSnakeCase("hello world", true); // "HELLO_WORLD"
165
+ * ```
166
+ */
167
+ export declare function toSnakeCase(str?: string, caps?: boolean): string;
168
+ /**
169
+ * Convert a string to kebab case.
170
+ * @param {string} [str] String to convert to kebab case.
171
+ * @param {boolean} [caps] Whether to convert to upper case.
172
+ * @returns {string} String in kebab case.
173
+ *
174
+ * @example
175
+ * ```TypeScript
176
+ * toKebabCase("hello world"); // "hello-world"
177
+ * ```
178
+ *
179
+ * @example
180
+ * ```TypeScript
181
+ * toKebabCase("hello world", true); // "HELLO-WORLD"
182
+ * ```
183
+ */
184
+ export declare function toKebabCase(str?: string, caps?: boolean): string;
185
+ /**
186
+ * Converts a string to a number.
187
+ * @param {number|string} str String to convert to a number.
188
+ * @returns {number|undefined} Number or undefined.
189
+ *
190
+ * @example
191
+ * ```TypeScript
192
+ * toNumber("123"); // 123
193
+ * ```
194
+ */
195
+ export declare function toNumber(str: number | string): number | undefined;
196
+ /**
197
+ * Remove HTML tags from a string and return plain text.
198
+ * @param {string} str String to remove HTML tags from.
199
+ * @returns {string} Plain text.
200
+ *
201
+ * @example
202
+ * ```TypeScript
203
+ * htmlToText("<h1>Hello World</h1>"); // "Hello World"
204
+ * ```
205
+ */
206
+ export declare function htmlToText(str: string): string;
207
+ /**
208
+ * Handles converting plural words to their singular form.
209
+ * @param {string} str String to convert to singular.
210
+ * @returns {string} Singular form of the string.
211
+ *
212
+ * @example
213
+ * ```TypeScript
214
+ * singular("children"); // "child"
215
+ * ```
216
+ */
217
+ export declare function singular(str: string): string;
@@ -0,0 +1,314 @@
1
+ "use strict";
2
+ // noinspection JSUnusedGlobalSymbols
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.breakToWords = breakToWords;
5
+ exports.toLowerCase = toLowerCase;
6
+ exports.toLowerCaseBreak = toLowerCaseBreak;
7
+ exports.toUpperCase = toUpperCase;
8
+ exports.toUpperCaseBreak = toUpperCaseBreak;
9
+ exports.toFirstCase = toFirstCase;
10
+ exports.toFirstCaseBreak = toFirstCaseBreak;
11
+ exports.toTitleCase = toTitleCase;
12
+ exports.toCamelCase = toCamelCase;
13
+ exports.toPascalCase = toPascalCase;
14
+ exports.toSentenceCase = toSentenceCase;
15
+ exports.toSnakeCase = toSnakeCase;
16
+ exports.toKebabCase = toKebabCase;
17
+ exports.toNumber = toNumber;
18
+ exports.htmlToText = htmlToText;
19
+ exports.singular = singular;
20
+ function breakToWords(str, format) {
21
+ var _a, _b;
22
+ if (!str) {
23
+ return format ? "" : [];
24
+ }
25
+ try {
26
+ const words = (_b = (_a = str
27
+ .match(/[A-Z]{2,}(?=[A-Z][a-z]+\d*|\b)|[A-Z]?[a-z]+\d*|[A-Z]+|\d+/g)) === null || _a === void 0 ? void 0 : _a.map((s) => s.toLowerCase())) !== null && _b !== void 0 ? _b : [];
28
+ return format ? words.map(format).join(" ") : words;
29
+ }
30
+ catch (_c) {
31
+ return format ? "" : [];
32
+ }
33
+ }
34
+ /**
35
+ * Convert a string to lower case.
36
+ * @param {string} [str] String to convert to lower case.
37
+ * @returns {string} String in lower case.
38
+ *
39
+ * @example
40
+ * ```TypeScript
41
+ * toLowerCase("Hello World"); // "hello world"
42
+ * ```
43
+ */
44
+ function toLowerCase(str) {
45
+ if (!str) {
46
+ return "";
47
+ }
48
+ return str.toLowerCase();
49
+ }
50
+ /**
51
+ * Convert a string to lower cases and break into words with optional join or space.
52
+ * @param {string} [str] String to convert to lower cases and break into words.
53
+ * @param {string} [join] Optional string to join the words with.
54
+ * @returns {string} String in lower cases and broken into words.
55
+ *
56
+ * @example
57
+ * ```TypeScript
58
+ * toLowerCaseBreak("HelloWorld"); // "hello world"
59
+ * ```
60
+ */
61
+ function toLowerCaseBreak(str, join) {
62
+ if (!str) {
63
+ return "";
64
+ }
65
+ return breakToWords(str)
66
+ .map(s => s.toLowerCase())
67
+ .join(join !== null && join !== void 0 ? join : " ");
68
+ }
69
+ /**
70
+ * Convert a string to upper case.
71
+ * @param {string} [str] String to convert to upper case.
72
+ * @returns {string} String in upper case.
73
+ *
74
+ * @example
75
+ * ```TypeScript
76
+ * toUpperCase("HelloWorld"); // "HELLO WORLD"
77
+ * ```
78
+ */
79
+ function toUpperCase(str) {
80
+ if (!str) {
81
+ return "";
82
+ }
83
+ return str.toUpperCase();
84
+ }
85
+ /**
86
+ * Convert a string to upper cases and break into words with optional join or space.
87
+ * @param {string} [str] String to convert to upper cases and break into words.
88
+ * @param {string} [join] Optional string to join the words with.
89
+ * @returns {string} String in upper cases and broken into words.
90
+ *
91
+ * @example
92
+ * ```TypeScript
93
+ * toUpperCaseBreak("HelloWorld"); // "HELLO WORLD"
94
+ * ```
95
+ *
96
+ * @example
97
+ * ```TypeScript
98
+ * toUpperCaseBreak("HelloWorld", "! "); // "HELLO! WORLD"
99
+ */
100
+ function toUpperCaseBreak(str, join) {
101
+ if (!str) {
102
+ return "";
103
+ }
104
+ return breakToWords(str)
105
+ .map(s => s.toUpperCase())
106
+ .join(join !== null && join !== void 0 ? join : " ");
107
+ }
108
+ /**
109
+ * Convert a string to first case (Capitalize first letter of the string).
110
+ * @param {string} [str] Optional string to join the words with.
111
+ * @returns {string} String in first case.
112
+ *
113
+ * @example
114
+ * ```TypeScript
115
+ * toFirstCase("hello world"); // "Hello world"
116
+ * ```
117
+ */
118
+ function toFirstCase(str) {
119
+ var _a;
120
+ if (!str) {
121
+ return "";
122
+ }
123
+ return (((_a = str[0]) === null || _a === void 0 ? void 0 : _a.toUpperCase()) || "") + str.slice(1).toLowerCase();
124
+ }
125
+ function toFirstCaseBreak(str, join) {
126
+ if (!str) {
127
+ return "";
128
+ }
129
+ return breakToWords(str)
130
+ .map((s, i) => (i === 0 ? toFirstCase(s) : s.toLowerCase()))
131
+ .join(join !== null && join !== void 0 ? join : " ");
132
+ }
133
+ /**
134
+ * Convert a string to title case (Capitalize first letter of each word).
135
+ * @param {string} [str] String to convert to title case.
136
+ * @returns {string} String in title case.
137
+ *
138
+ * @example
139
+ * ```TypeScript
140
+ * toTitleCase("hello world"); // "Hello World"
141
+ * ```
142
+ */
143
+ function toTitleCase(str) {
144
+ if (!str) {
145
+ return "";
146
+ }
147
+ return breakToWords(str)
148
+ .map(s => toFirstCase(s))
149
+ .join(" ");
150
+ }
151
+ /**
152
+ * Convert a string to camel case.
153
+ * @param {string} [str] String to convert to camel case.
154
+ * @returns {string} String in camel case.
155
+ *
156
+ * @example
157
+ * ```TypeScript
158
+ * toCamelCase("hello world"); // "helloWorld"
159
+ * ```
160
+ */
161
+ function toCamelCase(str) {
162
+ if (!str) {
163
+ return "";
164
+ }
165
+ return breakToWords(str)
166
+ .map((s, i) => (i === 0 ? s.toLowerCase() : toFirstCase(s)))
167
+ .join("");
168
+ }
169
+ /**
170
+ * Convert a string to pascal case.
171
+ * @param {string} [str] String to convert to pascal case.
172
+ * @returns {string} String in pascal case.
173
+ *
174
+ * @example
175
+ * ```TypeScript
176
+ * toPascalCase("hello world"); // "HelloWorld"
177
+ * ```
178
+ */
179
+ function toPascalCase(str) {
180
+ if (!str) {
181
+ return "";
182
+ }
183
+ return breakToWords(str)
184
+ .map(s => toFirstCase(s))
185
+ .join("");
186
+ }
187
+ /**
188
+ * Convert a string to sentence case. (Capitalize first letter of every sentence).
189
+ * @param {string} [str] String to convert to sentence case.
190
+ * @returns {string} String in sentence case.
191
+ *
192
+ * @example
193
+ * ```TypeScript
194
+ * toSentenceCase("hello world. how are you?"); // "Hello world. How are you?"
195
+ * ```
196
+ */
197
+ function toSentenceCase(str) {
198
+ return str
199
+ .split(".")
200
+ .map(s => toFirstCase(s.trim()))
201
+ .join(". ");
202
+ }
203
+ /**
204
+ * Convert a string to snake case.
205
+ * @param {string} [str] String to convert to snake case.
206
+ * @param {boolean} [caps] Whether to convert to upper case.
207
+ * @returns {string} String in snake case.
208
+ *
209
+ * @example
210
+ * ```TypeScript
211
+ * toSnakeCase("hello world"); // "hello_world"
212
+ *```
213
+ *
214
+ * @example
215
+ * ```TypeScript
216
+ * toSnakeCase("hello world", true); // "HELLO_WORLD"
217
+ * ```
218
+ */
219
+ function toSnakeCase(str, caps) {
220
+ if (!str) {
221
+ return "";
222
+ }
223
+ const snake = breakToWords(str).join("_");
224
+ return caps ? snake.toUpperCase() : snake.toLowerCase();
225
+ }
226
+ /**
227
+ * Convert a string to kebab case.
228
+ * @param {string} [str] String to convert to kebab case.
229
+ * @param {boolean} [caps] Whether to convert to upper case.
230
+ * @returns {string} String in kebab case.
231
+ *
232
+ * @example
233
+ * ```TypeScript
234
+ * toKebabCase("hello world"); // "hello-world"
235
+ * ```
236
+ *
237
+ * @example
238
+ * ```TypeScript
239
+ * toKebabCase("hello world", true); // "HELLO-WORLD"
240
+ * ```
241
+ */
242
+ function toKebabCase(str, caps) {
243
+ if (!str) {
244
+ return "";
245
+ }
246
+ const kebab = breakToWords(str).join("-");
247
+ return caps ? kebab.toUpperCase() : kebab.toLowerCase();
248
+ }
249
+ /**
250
+ * Converts a string to a number.
251
+ * @param {number|string} str String to convert to a number.
252
+ * @returns {number|undefined} Number or undefined.
253
+ *
254
+ * @example
255
+ * ```TypeScript
256
+ * toNumber("123"); // 123
257
+ * ```
258
+ */
259
+ function toNumber(str) {
260
+ return !isNaN(Number(str)) ? Number(str) : undefined;
261
+ }
262
+ /**
263
+ * Remove HTML tags from a string and return plain text.
264
+ * @param {string} str String to remove HTML tags from.
265
+ * @returns {string} Plain text.
266
+ *
267
+ * @example
268
+ * ```TypeScript
269
+ * htmlToText("<h1>Hello World</h1>"); // "Hello World"
270
+ * ```
271
+ */
272
+ function htmlToText(str) {
273
+ return str.replace(/<[^>]*>?/gm, "");
274
+ }
275
+ /**
276
+ * Handles converting plural words to their singular form.
277
+ * @param {string} str String to convert to singular.
278
+ * @returns {string} Singular form of the string.
279
+ *
280
+ * @example
281
+ * ```TypeScript
282
+ * singular("children"); // "child"
283
+ * ```
284
+ */
285
+ function singular(str) {
286
+ if (!str)
287
+ return str;
288
+ // General rules and exceptions for singularizing
289
+ const rules = [
290
+ { regex: /children$/i, replacement: "child" }, // e.g., children -> child
291
+ { regex: /men$/i, replacement: "man" }, // e.g., men -> man
292
+ { regex: /women$/i, replacement: "woman" }, // e.g., women -> woman
293
+ { regex: /teeth$/i, replacement: "tooth" }, // e.g., teeth -> tooth
294
+ { regex: /feet$/i, replacement: "foot" }, // e.g., feet -> foot
295
+ // eslint-disable-next-line @typescript-eslint/no-magic-numbers
296
+ { regex: /(buses|dishes|matches)$/i, replacement: (match) => match.slice(0, -2) }, // e.g., buses -> bus
297
+ { regex: /oes$/i, replacement: "o" }, // e.g., potatoes -> potato
298
+ { regex: /ies$/i, replacement: "y" }, // e.g., parties -> party
299
+ { regex: /ves$/i, replacement: "f" }, // e.g., wolves -> wolf
300
+ { regex: /cacti$/i, replacement: "cactus" }, // e.g., cacti -> cactus
301
+ { regex: /data$/i, replacement: "datum" }, // e.g., data -> datum
302
+ { regex: /phenomena$/i, replacement: "phenomenon" }, // e.g., phenomena -> phenomenon
303
+ { regex: /s$/i, replacement: "" }, // e.g., cats -> cat
304
+ ];
305
+ // Iterate over rules and apply the first matching one
306
+ for (const rule of rules) {
307
+ if (rule.regex.test(str)) {
308
+ return str.replace(rule.regex, typeof rule.replacement === "string" ? rule.replacement : rule.replacement(str));
309
+ }
310
+ }
311
+ // Return the original string if no rules match
312
+ return str;
313
+ }
314
+ //# sourceMappingURL=string.utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"string.utils.js","sourceRoot":"","sources":["../../../../../libs/utils/src/lib/string.utils.ts"],"names":[],"mappings":";AAAA,qCAAqC;;AAgDrC,oCAaC;AAYD,kCAKC;AAaD,4CAOC;AAYD,kCAKC;AAiBD,4CAOC;AAYD,kCAKC;AAED,4CAOC;AAYD,kCAOC;AAYD,kCAOC;AAYD,oCAOC;AAYD,wCAKC;AAkBD,kCAMC;AAkBD,kCAMC;AAYD,4BAEC;AAYD,gCAEC;AAYD,4BAuCC;AA9TD,SAAgB,YAAY,CAAC,GAAW,EAAE,MAAgC;;IACtE,IAAI,CAAC,GAAG,EAAE,CAAC;QACP,OAAO,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC5B,CAAC;IACD,IAAI,CAAC;QACD,MAAM,KAAK,GACP,MAAA,MAAA,GAAG;aACE,KAAK,CAAC,4DAA4D,CAAC,0CAClE,GAAG,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,mCAAI,EAAE,CAAC;QACpD,OAAO,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IACxD,CAAC;IAAC,WAAM,CAAC;QACL,OAAO,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC5B,CAAC;AACL,CAAC;AAED;;;;;;;;;GASG;AACH,SAAgB,WAAW,CAAC,GAAY;IACpC,IAAI,CAAC,GAA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E,WAAW,EAAE,YAAY,EAAE,EAAE,gCAAgC;QACrF,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,EAAE,EAAE,oBAAoB;KAC1D,CAAC;IAEF,sDAAsD;IACtD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACvB,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YACvB,OAAO,GAAG,CAAC,OAAO,CACd,IAAI,CAAC,KAAK,EACV,OAAO,IAAI,CAAC,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAClF,CAAC;QACN,CAAC;IACL,CAAC;IAED,+CAA+C;IAC/C,OAAO,GAAG,CAAC;AACf,CAAC"}
@@ -0,0 +1,20 @@
1
+ export type LiteralObject<T = any> = {
2
+ [key: string]: T;
3
+ };
4
+ export type PartialWithNull<T> = {
5
+ [p in keyof T]?: T[p] | null;
6
+ };
7
+ /**
8
+ * Represents a type for autocompleting string values.
9
+ *
10
+ * The `LooseAutocomplete` type allows autocompletion for a set of predefined string literals
11
+ * while still permitting other string values that are not part of the predefined set.
12
+ *
13
+ * This is useful in cases where a set of recommended values is available,
14
+ * but the user is also given the flexibility to provide custom input as needed.
15
+ *
16
+ * @template T Extends string - The set of predefined literal string options for autocompletion.
17
+ *
18
+ * @author Matt Pocock (https://www.totaltypescript.com/tips/create-autocomplete-helper-which-allows-for-arbitrary-values)
19
+ */
20
+ export type LooseAutocomplete<T extends string> = T | Omit<string, T>;
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ /* eslint-disable @typescript-eslint/no-explicit-any */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../libs/utils/src/lib/types.ts"],"names":[],"mappings":";AAAA,uDAAuD"}
@@ -0,0 +1,7 @@
1
+ export * from "./interfaces";
2
+ export * from "./types";
3
+ export * from "./string.utils";
4
+ export * from "./string-template.utils";
5
+ export * from "./object.utils";
6
+ export * from "./file.utils";
7
+ export * from "./assertions.utils";
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./interfaces"), exports);
5
+ tslib_1.__exportStar(require("./types"), exports);
6
+ tslib_1.__exportStar(require("./string.utils"), exports);
7
+ tslib_1.__exportStar(require("./string-template.utils"), exports);
8
+ tslib_1.__exportStar(require("./object.utils"), exports);
9
+ tslib_1.__exportStar(require("./file.utils"), exports);
10
+ tslib_1.__exportStar(require("./assertions.utils"), exports);
11
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../libs/utils/src/lib/utils.ts"],"names":[],"mappings":";;;AAAA,uDAA6B;AAC7B,kDAAwB;AACxB,yDAA+B;AAC/B,kEAAwC;AACxC,yDAA+B;AAC/B,uDAA6B;AAC7B,6DAAmC"}