@hichchi/utils 0.0.1-alpha.0 → 0.0.1-alpha.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.
- package/CHANGELOG.md +4 -0
- package/README.md +1745 -383
- package/package.json +1 -1
- package/src/index.d.ts +1 -1
- package/src/index.js +1 -1
- package/src/index.js.map +1 -1
- package/src/lib/{utils.js → index.js} +1 -1
- package/src/lib/index.js.map +1 -0
- package/src/lib/utils.js.map +0 -1
- /package/src/lib/{utils.d.ts → index.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -18,39 +18,142 @@ Run `nx test utils` to execute the unit tests via [Jest](https://jestjs.io).
|
|
|
18
18
|
|
|
19
19
|
### InfiniteObject
|
|
20
20
|
|
|
21
|
+
Defined in: [interfaces.ts:1](https://github.com/hichchidev/hichchi/blob/06777a67b73a055af108a17d7e01cf94eabb6608/libs/utils/src/lib/interfaces.ts#L1)
|
|
22
|
+
|
|
21
23
|
#### Indexable
|
|
22
24
|
|
|
23
|
-
|
|
25
|
+
```ts
|
|
26
|
+
[key: string]: InfiniteObject
|
|
27
|
+
```
|
|
24
28
|
|
|
25
29
|
---
|
|
26
30
|
|
|
27
31
|
### PathValueSet
|
|
28
32
|
|
|
33
|
+
Defined in: [interfaces.ts:5](https://github.com/hichchidev/hichchi/blob/06777a67b73a055af108a17d7e01cf94eabb6608/libs/utils/src/lib/interfaces.ts#L5)
|
|
34
|
+
|
|
29
35
|
#### Indexable
|
|
30
36
|
|
|
31
|
-
|
|
37
|
+
```ts
|
|
38
|
+
[path: string]: string | number | boolean
|
|
39
|
+
```
|
|
32
40
|
|
|
33
41
|
## Type Aliases
|
|
34
42
|
|
|
35
43
|
### LiteralObject\<T\>
|
|
36
44
|
|
|
37
45
|
```ts
|
|
38
|
-
type LiteralObject<T
|
|
46
|
+
type LiteralObject<T> = object;
|
|
39
47
|
```
|
|
40
48
|
|
|
49
|
+
Defined in: [types.ts:3](https://github.com/hichchidev/hichchi/blob/06777a67b73a055af108a17d7e01cf94eabb6608/libs/utils/src/lib/types.ts#L3)
|
|
50
|
+
|
|
41
51
|
#### Type Parameters
|
|
42
52
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
53
|
+
<table>
|
|
54
|
+
<thead>
|
|
55
|
+
<tr>
|
|
56
|
+
<th>Type Parameter</th>
|
|
57
|
+
<th>Default type</th>
|
|
58
|
+
</tr>
|
|
59
|
+
</thead>
|
|
60
|
+
<tbody>
|
|
61
|
+
<tr>
|
|
62
|
+
<td>
|
|
63
|
+
|
|
64
|
+
`T`
|
|
65
|
+
|
|
66
|
+
</td>
|
|
67
|
+
<td>
|
|
68
|
+
|
|
69
|
+
`any`
|
|
70
|
+
|
|
71
|
+
</td>
|
|
72
|
+
</tr>
|
|
73
|
+
</tbody>
|
|
74
|
+
</table>
|
|
46
75
|
|
|
47
76
|
#### Index Signature
|
|
48
77
|
|
|
49
|
-
|
|
78
|
+
```ts
|
|
79
|
+
[key: string]: T
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
### LooseAutocomplete\<T\>
|
|
85
|
+
|
|
86
|
+
```ts
|
|
87
|
+
type LooseAutocomplete<T> = T | Omit<string, T>;
|
|
88
|
+
```
|
|
50
89
|
|
|
51
|
-
|
|
90
|
+
Defined in: [types.ts:24](https://github.com/hichchidev/hichchi/blob/06777a67b73a055af108a17d7e01cf94eabb6608/libs/utils/src/lib/types.ts#L24)
|
|
52
91
|
|
|
53
|
-
|
|
92
|
+
Represents a type for autocompleting string values.
|
|
93
|
+
|
|
94
|
+
The `LooseAutocomplete` type allows autocompletion for a set of predefined string literals
|
|
95
|
+
while still permitting other string values that are not part of the predefined set.
|
|
96
|
+
|
|
97
|
+
This is useful in cases where a set of recommended values is available,
|
|
98
|
+
but the user is also given the flexibility to provide custom input as needed.
|
|
99
|
+
|
|
100
|
+
#### Type Parameters
|
|
101
|
+
|
|
102
|
+
<table>
|
|
103
|
+
<thead>
|
|
104
|
+
<tr>
|
|
105
|
+
<th>Type Parameter</th>
|
|
106
|
+
<th>Description</th>
|
|
107
|
+
</tr>
|
|
108
|
+
</thead>
|
|
109
|
+
<tbody>
|
|
110
|
+
<tr>
|
|
111
|
+
<td>
|
|
112
|
+
|
|
113
|
+
`T` _extends_ `string`
|
|
114
|
+
|
|
115
|
+
</td>
|
|
116
|
+
<td>
|
|
117
|
+
|
|
118
|
+
Extends string - The set of predefined literal string options for autocompletion.
|
|
119
|
+
|
|
120
|
+
</td>
|
|
121
|
+
</tr>
|
|
122
|
+
</tbody>
|
|
123
|
+
</table>
|
|
124
|
+
|
|
125
|
+
#### Author
|
|
126
|
+
|
|
127
|
+
Matt Pocock (https://www.totaltypescript.com/tips/create-autocomplete-helper-which-allows-for-arbitrary-values)
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
### PartialWithNull\<T\>
|
|
132
|
+
|
|
133
|
+
```ts
|
|
134
|
+
type PartialWithNull<T> = { [p in keyof T]?: T[p] | null };
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Defined in: [types.ts:7](https://github.com/hichchidev/hichchi/blob/06777a67b73a055af108a17d7e01cf94eabb6608/libs/utils/src/lib/types.ts#L7)
|
|
138
|
+
|
|
139
|
+
#### Type Parameters
|
|
140
|
+
|
|
141
|
+
<table>
|
|
142
|
+
<thead>
|
|
143
|
+
<tr>
|
|
144
|
+
<th>Type Parameter</th>
|
|
145
|
+
</tr>
|
|
146
|
+
</thead>
|
|
147
|
+
<tbody>
|
|
148
|
+
<tr>
|
|
149
|
+
<td>
|
|
150
|
+
|
|
151
|
+
`T`
|
|
152
|
+
|
|
153
|
+
</td>
|
|
154
|
+
</tr>
|
|
155
|
+
</tbody>
|
|
156
|
+
</table>
|
|
54
157
|
|
|
55
158
|
## Variables
|
|
56
159
|
|
|
@@ -60,20 +163,20 @@ types.ts:3
|
|
|
60
163
|
const mimeTypes: Map<string, string>;
|
|
61
164
|
```
|
|
62
165
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
#### Defined in
|
|
166
|
+
Defined in: [file.utils.ts:8](https://github.com/hichchidev/hichchi/blob/06777a67b73a055af108a17d7e01cf94eabb6608/libs/utils/src/lib/file.utils.ts#L8)
|
|
66
167
|
|
|
67
|
-
file.
|
|
168
|
+
Map of mime types to all file extensions.
|
|
68
169
|
|
|
69
170
|
## Functions
|
|
70
171
|
|
|
71
172
|
### applyTemplate()
|
|
72
173
|
|
|
73
174
|
```ts
|
|
74
|
-
function applyTemplate(str
|
|
175
|
+
function applyTemplate(str, prefix): string;
|
|
75
176
|
```
|
|
76
177
|
|
|
178
|
+
Defined in: [string-template.utils.ts:29](https://github.com/hichchidev/hichchi/blob/06777a67b73a055af108a17d7e01cf94eabb6608/libs/utils/src/lib/string-template.utils.ts#L29)
|
|
179
|
+
|
|
77
180
|
Apply error message prefix to a valid template string
|
|
78
181
|
|
|
79
182
|
Acceptable template tags:
|
|
@@ -87,10 +190,51 @@ Acceptable template tags:
|
|
|
87
190
|
|
|
88
191
|
#### Parameters
|
|
89
192
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
193
|
+
<table>
|
|
194
|
+
<thead>
|
|
195
|
+
<tr>
|
|
196
|
+
<th>Parameter</th>
|
|
197
|
+
<th>Type</th>
|
|
198
|
+
<th>Description</th>
|
|
199
|
+
</tr>
|
|
200
|
+
</thead>
|
|
201
|
+
<tbody>
|
|
202
|
+
<tr>
|
|
203
|
+
<td>
|
|
204
|
+
|
|
205
|
+
`str`
|
|
206
|
+
|
|
207
|
+
</td>
|
|
208
|
+
<td>
|
|
209
|
+
|
|
210
|
+
`string`
|
|
211
|
+
|
|
212
|
+
</td>
|
|
213
|
+
<td>
|
|
214
|
+
|
|
215
|
+
Template string to apply prefix
|
|
216
|
+
|
|
217
|
+
</td>
|
|
218
|
+
</tr>
|
|
219
|
+
<tr>
|
|
220
|
+
<td>
|
|
221
|
+
|
|
222
|
+
`prefix`
|
|
223
|
+
|
|
224
|
+
</td>
|
|
225
|
+
<td>
|
|
226
|
+
|
|
227
|
+
`string`
|
|
228
|
+
|
|
229
|
+
</td>
|
|
230
|
+
<td>
|
|
231
|
+
|
|
232
|
+
Prefix to apply
|
|
233
|
+
|
|
234
|
+
</td>
|
|
235
|
+
</tr>
|
|
236
|
+
</tbody>
|
|
237
|
+
</table>
|
|
94
238
|
|
|
95
239
|
#### Returns
|
|
96
240
|
|
|
@@ -102,16 +246,12 @@ Prefix applied string
|
|
|
102
246
|
|
|
103
247
|
```TypeScript
|
|
104
248
|
applyTemplate(
|
|
105
|
-
|
|
106
|
-
|
|
249
|
+
'Cannot create a #{lowerCase} with this email. #{sentenceCase} already exists.',
|
|
250
|
+
'User'
|
|
107
251
|
);
|
|
108
252
|
// Output: Cannot create a user with this email. User exists.
|
|
109
253
|
```
|
|
110
254
|
|
|
111
|
-
#### Defined in
|
|
112
|
-
|
|
113
|
-
string-template.utils.ts:29
|
|
114
|
-
|
|
115
255
|
---
|
|
116
256
|
|
|
117
257
|
### breakToWords()
|
|
@@ -119,18 +259,45 @@ string-template.utils.ts:29
|
|
|
119
259
|
#### Call Signature
|
|
120
260
|
|
|
121
261
|
```ts
|
|
122
|
-
function breakToWords(str
|
|
262
|
+
function breakToWords(str): string[];
|
|
123
263
|
```
|
|
124
264
|
|
|
265
|
+
Defined in: [string.utils.ts:31](https://github.com/hichchidev/hichchi/blob/06777a67b73a055af108a17d7e01cf94eabb6608/libs/utils/src/lib/string.utils.ts#L31)
|
|
266
|
+
|
|
125
267
|
Break a string into words array.<br>
|
|
126
268
|
|
|
127
269
|
This function will break any of below to words in examples into `['hello', 'world']`<br>
|
|
128
270
|
|
|
129
271
|
##### Parameters
|
|
130
272
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
273
|
+
<table>
|
|
274
|
+
<thead>
|
|
275
|
+
<tr>
|
|
276
|
+
<th>Parameter</th>
|
|
277
|
+
<th>Type</th>
|
|
278
|
+
<th>Description</th>
|
|
279
|
+
</tr>
|
|
280
|
+
</thead>
|
|
281
|
+
<tbody>
|
|
282
|
+
<tr>
|
|
283
|
+
<td>
|
|
284
|
+
|
|
285
|
+
`str`
|
|
286
|
+
|
|
287
|
+
</td>
|
|
288
|
+
<td>
|
|
289
|
+
|
|
290
|
+
`string`
|
|
291
|
+
|
|
292
|
+
</td>
|
|
293
|
+
<td>
|
|
294
|
+
|
|
295
|
+
String to break into words.
|
|
296
|
+
|
|
297
|
+
</td>
|
|
298
|
+
</tr>
|
|
299
|
+
</tbody>
|
|
300
|
+
</table>
|
|
134
301
|
|
|
135
302
|
##### Returns
|
|
136
303
|
|
|
@@ -156,26 +323,65 @@ breakToWords("hello-world"); // ['hello', 'world']
|
|
|
156
323
|
breakToWords("hello world"); // ['hello', 'world']
|
|
157
324
|
```
|
|
158
325
|
|
|
159
|
-
##### Defined in
|
|
160
|
-
|
|
161
|
-
string.utils.ts:31
|
|
162
|
-
|
|
163
326
|
#### Call Signature
|
|
164
327
|
|
|
165
328
|
```ts
|
|
166
|
-
function breakToWords(str
|
|
329
|
+
function breakToWords(str, format): string;
|
|
167
330
|
```
|
|
168
331
|
|
|
332
|
+
Defined in: [string.utils.ts:47](https://github.com/hichchidev/hichchi/blob/06777a67b73a055af108a17d7e01cf94eabb6608/libs/utils/src/lib/string.utils.ts#L47)
|
|
333
|
+
|
|
169
334
|
Break a string into words array and format the string.<br>
|
|
170
335
|
|
|
171
|
-
This function will break
|
|
336
|
+
This function will break string into words and format the string using the provided function.<br>
|
|
172
337
|
|
|
173
338
|
##### Parameters
|
|
174
339
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
340
|
+
<table>
|
|
341
|
+
<thead>
|
|
342
|
+
<tr>
|
|
343
|
+
<th>Parameter</th>
|
|
344
|
+
<th>Type</th>
|
|
345
|
+
<th>Description</th>
|
|
346
|
+
</tr>
|
|
347
|
+
</thead>
|
|
348
|
+
<tbody>
|
|
349
|
+
<tr>
|
|
350
|
+
<td>
|
|
351
|
+
|
|
352
|
+
`str`
|
|
353
|
+
|
|
354
|
+
</td>
|
|
355
|
+
<td>
|
|
356
|
+
|
|
357
|
+
`string`
|
|
358
|
+
|
|
359
|
+
</td>
|
|
360
|
+
<td>
|
|
361
|
+
|
|
362
|
+
String to break into words.
|
|
363
|
+
|
|
364
|
+
</td>
|
|
365
|
+
</tr>
|
|
366
|
+
<tr>
|
|
367
|
+
<td>
|
|
368
|
+
|
|
369
|
+
`format`
|
|
370
|
+
|
|
371
|
+
</td>
|
|
372
|
+
<td>
|
|
373
|
+
|
|
374
|
+
(`str`) => `string`
|
|
375
|
+
|
|
376
|
+
</td>
|
|
377
|
+
<td>
|
|
378
|
+
|
|
379
|
+
Formatting function.
|
|
380
|
+
|
|
381
|
+
</td>
|
|
382
|
+
</tr>
|
|
383
|
+
</tbody>
|
|
384
|
+
</table>
|
|
179
385
|
|
|
180
386
|
##### Returns
|
|
181
387
|
|
|
@@ -186,34 +392,76 @@ Formatted string.
|
|
|
186
392
|
##### Example
|
|
187
393
|
|
|
188
394
|
```TypeScript
|
|
189
|
-
breakToWords("helloWorld", toFirstCase); // Hello world
|
|
395
|
+
breakToWords("helloWorld" , toFirstCase); // Hello world
|
|
190
396
|
```
|
|
191
397
|
|
|
192
|
-
##### Defined in
|
|
193
|
-
|
|
194
|
-
string.utils.ts:47
|
|
195
|
-
|
|
196
398
|
---
|
|
197
399
|
|
|
198
400
|
### deepCopy()
|
|
199
401
|
|
|
200
402
|
```ts
|
|
201
|
-
function deepCopy<T>(obj
|
|
403
|
+
function deepCopy<T>(obj): T;
|
|
202
404
|
```
|
|
203
405
|
|
|
406
|
+
Defined in: [object.utils.ts:23](https://github.com/hichchidev/hichchi/blob/06777a67b73a055af108a17d7e01cf94eabb6608/libs/utils/src/lib/object.utils.ts#L23)
|
|
407
|
+
|
|
204
408
|
Deep copy an object.
|
|
205
409
|
|
|
206
410
|
#### Type Parameters
|
|
207
411
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
412
|
+
<table>
|
|
413
|
+
<thead>
|
|
414
|
+
<tr>
|
|
415
|
+
<th>Type Parameter</th>
|
|
416
|
+
<th>Description</th>
|
|
417
|
+
</tr>
|
|
418
|
+
</thead>
|
|
419
|
+
<tbody>
|
|
420
|
+
<tr>
|
|
421
|
+
<td>
|
|
422
|
+
|
|
423
|
+
`T`
|
|
424
|
+
|
|
425
|
+
</td>
|
|
426
|
+
<td>
|
|
427
|
+
|
|
428
|
+
Type of the object.
|
|
429
|
+
|
|
430
|
+
</td>
|
|
431
|
+
</tr>
|
|
432
|
+
</tbody>
|
|
433
|
+
</table>
|
|
211
434
|
|
|
212
435
|
#### Parameters
|
|
213
436
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
437
|
+
<table>
|
|
438
|
+
<thead>
|
|
439
|
+
<tr>
|
|
440
|
+
<th>Parameter</th>
|
|
441
|
+
<th>Type</th>
|
|
442
|
+
<th>Description</th>
|
|
443
|
+
</tr>
|
|
444
|
+
</thead>
|
|
445
|
+
<tbody>
|
|
446
|
+
<tr>
|
|
447
|
+
<td>
|
|
448
|
+
|
|
449
|
+
`obj`
|
|
450
|
+
|
|
451
|
+
</td>
|
|
452
|
+
<td>
|
|
453
|
+
|
|
454
|
+
`T`
|
|
455
|
+
|
|
456
|
+
</td>
|
|
457
|
+
<td>
|
|
458
|
+
|
|
459
|
+
Object to copy.
|
|
460
|
+
|
|
461
|
+
</td>
|
|
462
|
+
</tr>
|
|
463
|
+
</tbody>
|
|
464
|
+
</table>
|
|
217
465
|
|
|
218
466
|
#### Returns
|
|
219
467
|
|
|
@@ -226,62 +474,137 @@ Copied object.
|
|
|
226
474
|
```TypeScript
|
|
227
475
|
// Example usage
|
|
228
476
|
const object = {
|
|
229
|
-
|
|
230
|
-
}
|
|
477
|
+
name: "John Doe"
|
|
478
|
+
}
|
|
231
479
|
|
|
232
480
|
const copiedObject = deepCopy(object);
|
|
233
481
|
```
|
|
234
482
|
|
|
235
|
-
#### Defined in
|
|
236
|
-
|
|
237
|
-
object.utils.ts:23
|
|
238
|
-
|
|
239
483
|
---
|
|
240
484
|
|
|
241
485
|
### getFileExt()
|
|
242
486
|
|
|
243
487
|
```ts
|
|
244
|
-
function getFileExt(
|
|
245
|
-
mimeType: string,
|
|
246
|
-
allowedMimeTypes?: Map<string, string>,
|
|
247
|
-
): string;
|
|
488
|
+
function getFileExt(mimeType, allowedMimeTypes?): undefined | string;
|
|
248
489
|
```
|
|
249
490
|
|
|
491
|
+
Defined in: [file.utils.ts:1217](https://github.com/hichchidev/hichchi/blob/06777a67b73a055af108a17d7e01cf94eabb6608/libs/utils/src/lib/file.utils.ts#L1217)
|
|
492
|
+
|
|
250
493
|
Get the file extension of the given mime type.
|
|
251
494
|
|
|
252
495
|
#### Parameters
|
|
253
496
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
497
|
+
<table>
|
|
498
|
+
<thead>
|
|
499
|
+
<tr>
|
|
500
|
+
<th>Parameter</th>
|
|
501
|
+
<th>Type</th>
|
|
502
|
+
<th>Description</th>
|
|
503
|
+
</tr>
|
|
504
|
+
</thead>
|
|
505
|
+
<tbody>
|
|
506
|
+
<tr>
|
|
507
|
+
<td>
|
|
258
508
|
|
|
259
|
-
|
|
509
|
+
`mimeType`
|
|
510
|
+
|
|
511
|
+
</td>
|
|
512
|
+
<td>
|
|
260
513
|
|
|
261
514
|
`string`
|
|
262
515
|
|
|
263
|
-
|
|
516
|
+
</td>
|
|
517
|
+
<td>
|
|
518
|
+
|
|
519
|
+
Mime type.
|
|
520
|
+
|
|
521
|
+
</td>
|
|
522
|
+
</tr>
|
|
523
|
+
<tr>
|
|
524
|
+
<td>
|
|
525
|
+
|
|
526
|
+
`allowedMimeTypes?`
|
|
527
|
+
|
|
528
|
+
</td>
|
|
529
|
+
<td>
|
|
264
530
|
|
|
265
|
-
|
|
531
|
+
`Map`\<`string`, `string`\>
|
|
266
532
|
|
|
267
|
-
|
|
533
|
+
</td>
|
|
534
|
+
<td>
|
|
535
|
+
|
|
536
|
+
Allowed mime types.
|
|
537
|
+
|
|
538
|
+
</td>
|
|
539
|
+
</tr>
|
|
540
|
+
</tbody>
|
|
541
|
+
</table>
|
|
542
|
+
|
|
543
|
+
#### Returns
|
|
544
|
+
|
|
545
|
+
`undefined` \| `string`
|
|
546
|
+
|
|
547
|
+
File extension.
|
|
268
548
|
|
|
269
549
|
---
|
|
270
550
|
|
|
271
551
|
### getFileSize()
|
|
272
552
|
|
|
273
553
|
```ts
|
|
274
|
-
function getFileSize(size
|
|
554
|
+
function getFileSize(size, round?): string;
|
|
275
555
|
```
|
|
276
556
|
|
|
557
|
+
Defined in: [file.utils.ts:1227](https://github.com/hichchidev/hichchi/blob/06777a67b73a055af108a17d7e01cf94eabb6608/libs/utils/src/lib/file.utils.ts#L1227)
|
|
558
|
+
|
|
277
559
|
Get file size in human-readable format.
|
|
278
560
|
|
|
279
561
|
#### Parameters
|
|
280
562
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
563
|
+
<table>
|
|
564
|
+
<thead>
|
|
565
|
+
<tr>
|
|
566
|
+
<th>Parameter</th>
|
|
567
|
+
<th>Type</th>
|
|
568
|
+
<th>Description</th>
|
|
569
|
+
</tr>
|
|
570
|
+
</thead>
|
|
571
|
+
<tbody>
|
|
572
|
+
<tr>
|
|
573
|
+
<td>
|
|
574
|
+
|
|
575
|
+
`size`
|
|
576
|
+
|
|
577
|
+
</td>
|
|
578
|
+
<td>
|
|
579
|
+
|
|
580
|
+
`number`
|
|
581
|
+
|
|
582
|
+
</td>
|
|
583
|
+
<td>
|
|
584
|
+
|
|
585
|
+
File size in bytes.
|
|
586
|
+
|
|
587
|
+
</td>
|
|
588
|
+
</tr>
|
|
589
|
+
<tr>
|
|
590
|
+
<td>
|
|
591
|
+
|
|
592
|
+
`round?`
|
|
593
|
+
|
|
594
|
+
</td>
|
|
595
|
+
<td>
|
|
596
|
+
|
|
597
|
+
`boolean`
|
|
598
|
+
|
|
599
|
+
</td>
|
|
600
|
+
<td>
|
|
601
|
+
|
|
602
|
+
Whether to round the size.
|
|
603
|
+
|
|
604
|
+
</td>
|
|
605
|
+
</tr>
|
|
606
|
+
</tbody>
|
|
607
|
+
</table>
|
|
285
608
|
|
|
286
609
|
#### Returns
|
|
287
610
|
|
|
@@ -289,33 +612,69 @@ Get file size in human-readable format.
|
|
|
289
612
|
|
|
290
613
|
File size in human-readable format.
|
|
291
614
|
|
|
292
|
-
#### Defined in
|
|
293
|
-
|
|
294
|
-
file.utils.ts:1227
|
|
295
|
-
|
|
296
615
|
---
|
|
297
616
|
|
|
298
617
|
### getMapKey()
|
|
299
618
|
|
|
300
619
|
```ts
|
|
301
|
-
function getMapKey(
|
|
302
|
-
map: Map<string, unknown>,
|
|
303
|
-
value: unknown,
|
|
304
|
-
): string | undefined;
|
|
620
|
+
function getMapKey(map, value): undefined | string;
|
|
305
621
|
```
|
|
306
622
|
|
|
623
|
+
Defined in: [object.utils.ts:53](https://github.com/hichchidev/hichchi/blob/06777a67b73a055af108a17d7e01cf94eabb6608/libs/utils/src/lib/object.utils.ts#L53)
|
|
624
|
+
|
|
307
625
|
Get the key of a map by value.
|
|
308
626
|
|
|
309
627
|
#### Parameters
|
|
310
628
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
629
|
+
<table>
|
|
630
|
+
<thead>
|
|
631
|
+
<tr>
|
|
632
|
+
<th>Parameter</th>
|
|
633
|
+
<th>Type</th>
|
|
634
|
+
<th>Description</th>
|
|
635
|
+
</tr>
|
|
636
|
+
</thead>
|
|
637
|
+
<tbody>
|
|
638
|
+
<tr>
|
|
639
|
+
<td>
|
|
640
|
+
|
|
641
|
+
`map`
|
|
642
|
+
|
|
643
|
+
</td>
|
|
644
|
+
<td>
|
|
645
|
+
|
|
646
|
+
`Map`\<`string`, `unknown`\>
|
|
647
|
+
|
|
648
|
+
</td>
|
|
649
|
+
<td>
|
|
650
|
+
|
|
651
|
+
Map to get key from.
|
|
652
|
+
|
|
653
|
+
</td>
|
|
654
|
+
</tr>
|
|
655
|
+
<tr>
|
|
656
|
+
<td>
|
|
657
|
+
|
|
658
|
+
`value`
|
|
659
|
+
|
|
660
|
+
</td>
|
|
661
|
+
<td>
|
|
662
|
+
|
|
663
|
+
`unknown`
|
|
664
|
+
|
|
665
|
+
</td>
|
|
666
|
+
<td>
|
|
667
|
+
|
|
668
|
+
Value to get key for.
|
|
669
|
+
|
|
670
|
+
</td>
|
|
671
|
+
</tr>
|
|
672
|
+
</tbody>
|
|
673
|
+
</table>
|
|
315
674
|
|
|
316
675
|
#### Returns
|
|
317
676
|
|
|
318
|
-
`
|
|
677
|
+
`undefined` \| `string`
|
|
319
678
|
|
|
320
679
|
Key of the map.
|
|
321
680
|
|
|
@@ -324,10 +683,10 @@ Key of the map.
|
|
|
324
683
|
```TypeScript
|
|
325
684
|
// Example usage
|
|
326
685
|
const user = new Map<string, string>([
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
686
|
+
["firstName", "John"],
|
|
687
|
+
["lastName", "Doe"],
|
|
688
|
+
["preferredName", "John"],
|
|
689
|
+
["age", 30],
|
|
331
690
|
]);
|
|
332
691
|
|
|
333
692
|
const key = getMapKey(user, "value2");
|
|
@@ -335,26 +694,65 @@ const key = getMapKey(user, "value2");
|
|
|
335
694
|
// Example output: "firstName"
|
|
336
695
|
```
|
|
337
696
|
|
|
338
|
-
#### Defined in
|
|
339
|
-
|
|
340
|
-
object.utils.ts:53
|
|
341
|
-
|
|
342
697
|
---
|
|
343
698
|
|
|
344
699
|
### getMapKeys()
|
|
345
700
|
|
|
346
701
|
```ts
|
|
347
|
-
function getMapKeys(map
|
|
702
|
+
function getMapKeys(map, partialValue): string[];
|
|
348
703
|
```
|
|
349
704
|
|
|
705
|
+
Defined in: [object.utils.ts:79](https://github.com/hichchidev/hichchi/blob/06777a67b73a055af108a17d7e01cf94eabb6608/libs/utils/src/lib/object.utils.ts#L79)
|
|
706
|
+
|
|
350
707
|
Get the keys of a map by partial value.
|
|
351
708
|
|
|
352
709
|
#### Parameters
|
|
353
710
|
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
711
|
+
<table>
|
|
712
|
+
<thead>
|
|
713
|
+
<tr>
|
|
714
|
+
<th>Parameter</th>
|
|
715
|
+
<th>Type</th>
|
|
716
|
+
<th>Description</th>
|
|
717
|
+
</tr>
|
|
718
|
+
</thead>
|
|
719
|
+
<tbody>
|
|
720
|
+
<tr>
|
|
721
|
+
<td>
|
|
722
|
+
|
|
723
|
+
`map`
|
|
724
|
+
|
|
725
|
+
</td>
|
|
726
|
+
<td>
|
|
727
|
+
|
|
728
|
+
`Map`\<`string`, `string`\>
|
|
729
|
+
|
|
730
|
+
</td>
|
|
731
|
+
<td>
|
|
732
|
+
|
|
733
|
+
Map to get keys from.
|
|
734
|
+
|
|
735
|
+
</td>
|
|
736
|
+
</tr>
|
|
737
|
+
<tr>
|
|
738
|
+
<td>
|
|
739
|
+
|
|
740
|
+
`partialValue`
|
|
741
|
+
|
|
742
|
+
</td>
|
|
743
|
+
<td>
|
|
744
|
+
|
|
745
|
+
`string`
|
|
746
|
+
|
|
747
|
+
</td>
|
|
748
|
+
<td>
|
|
749
|
+
|
|
750
|
+
Partial value to get keys for.
|
|
751
|
+
|
|
752
|
+
</td>
|
|
753
|
+
</tr>
|
|
754
|
+
</tbody>
|
|
755
|
+
</table>
|
|
358
756
|
|
|
359
757
|
#### Returns
|
|
360
758
|
|
|
@@ -367,48 +765,106 @@ Get the keys of a map by partial value.
|
|
|
367
765
|
```TypeScript
|
|
368
766
|
// Example usage
|
|
369
767
|
const user = new Map<string, string>([
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
768
|
+
["firstName", "John"],
|
|
769
|
+
["lastName", "Doe"],
|
|
770
|
+
["preferredName", "John"],
|
|
771
|
+
["age", 30],
|
|
374
772
|
]);
|
|
375
773
|
|
|
376
774
|
const keys = getMapKeys(user, "Jo");
|
|
377
775
|
|
|
378
776
|
// Example output
|
|
379
|
-
["firstName", "preferredName"]
|
|
777
|
+
["firstName", "preferredName"]
|
|
380
778
|
```
|
|
381
779
|
|
|
382
|
-
#### Defined in
|
|
383
|
-
|
|
384
|
-
object.utils.ts:79
|
|
385
|
-
|
|
386
780
|
---
|
|
387
781
|
|
|
388
782
|
### getValueByPath()
|
|
389
783
|
|
|
390
784
|
```ts
|
|
391
|
-
function getValueByPath<T>(obj
|
|
785
|
+
function getValueByPath<T>(obj, path): undefined | T;
|
|
392
786
|
```
|
|
393
787
|
|
|
788
|
+
Defined in: [object.utils.ts:196](https://github.com/hichchidev/hichchi/blob/06777a67b73a055af108a17d7e01cf94eabb6608/libs/utils/src/lib/object.utils.ts#L196)
|
|
789
|
+
|
|
394
790
|
Get value from an object by path.
|
|
395
791
|
|
|
396
792
|
#### Type Parameters
|
|
397
793
|
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
794
|
+
<table>
|
|
795
|
+
<thead>
|
|
796
|
+
<tr>
|
|
797
|
+
<th>Type Parameter</th>
|
|
798
|
+
<th>Description</th>
|
|
799
|
+
</tr>
|
|
800
|
+
</thead>
|
|
801
|
+
<tbody>
|
|
802
|
+
<tr>
|
|
803
|
+
<td>
|
|
804
|
+
|
|
805
|
+
`T`
|
|
806
|
+
|
|
807
|
+
</td>
|
|
808
|
+
<td>
|
|
809
|
+
|
|
810
|
+
Type of the value.
|
|
811
|
+
|
|
812
|
+
</td>
|
|
813
|
+
</tr>
|
|
814
|
+
</tbody>
|
|
815
|
+
</table>
|
|
401
816
|
|
|
402
817
|
#### Parameters
|
|
403
818
|
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
819
|
+
<table>
|
|
820
|
+
<thead>
|
|
821
|
+
<tr>
|
|
822
|
+
<th>Parameter</th>
|
|
823
|
+
<th>Type</th>
|
|
824
|
+
<th>Description</th>
|
|
825
|
+
</tr>
|
|
826
|
+
</thead>
|
|
827
|
+
<tbody>
|
|
828
|
+
<tr>
|
|
829
|
+
<td>
|
|
830
|
+
|
|
831
|
+
`obj`
|
|
832
|
+
|
|
833
|
+
</td>
|
|
834
|
+
<td>
|
|
835
|
+
|
|
836
|
+
[`InfiniteObject`](#infiniteobject)
|
|
837
|
+
|
|
838
|
+
</td>
|
|
839
|
+
<td>
|
|
840
|
+
|
|
841
|
+
Object to get value from.
|
|
842
|
+
|
|
843
|
+
</td>
|
|
844
|
+
</tr>
|
|
845
|
+
<tr>
|
|
846
|
+
<td>
|
|
847
|
+
|
|
848
|
+
`path`
|
|
849
|
+
|
|
850
|
+
</td>
|
|
851
|
+
<td>
|
|
852
|
+
|
|
853
|
+
`string`
|
|
854
|
+
|
|
855
|
+
</td>
|
|
856
|
+
<td>
|
|
857
|
+
|
|
858
|
+
Path to get value from.
|
|
859
|
+
|
|
860
|
+
</td>
|
|
861
|
+
</tr>
|
|
862
|
+
</tbody>
|
|
863
|
+
</table>
|
|
408
864
|
|
|
409
865
|
#### Returns
|
|
410
866
|
|
|
411
|
-
`T`
|
|
867
|
+
`undefined` \| `T`
|
|
412
868
|
|
|
413
869
|
Value from the object.
|
|
414
870
|
|
|
@@ -417,14 +873,14 @@ Value from the object.
|
|
|
417
873
|
```TypeScript
|
|
418
874
|
// Example usage
|
|
419
875
|
const object = {
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
876
|
+
role: "user",
|
|
877
|
+
profile: {
|
|
878
|
+
name: "John Doe",
|
|
879
|
+
age: 30,
|
|
880
|
+
address: {
|
|
881
|
+
city: "New York",
|
|
882
|
+
},
|
|
426
883
|
},
|
|
427
|
-
},
|
|
428
884
|
};
|
|
429
885
|
|
|
430
886
|
const value = getValueByPath<string>(object, "profile.address.city");
|
|
@@ -432,37 +888,106 @@ const value = getValueByPath<string>(object, "profile.address.city");
|
|
|
432
888
|
// Example output: "New York"
|
|
433
889
|
```
|
|
434
890
|
|
|
435
|
-
#### Defined in
|
|
436
|
-
|
|
437
|
-
object.utils.ts:196
|
|
438
|
-
|
|
439
891
|
---
|
|
440
892
|
|
|
441
893
|
### groupBy()
|
|
442
894
|
|
|
443
895
|
```ts
|
|
444
|
-
function groupBy<K, V>(list
|
|
896
|
+
function groupBy<K, V>(list, keyGetter): Map<null | K, V[]>;
|
|
445
897
|
```
|
|
446
898
|
|
|
899
|
+
Defined in: [object.utils.ts:125](https://github.com/hichchidev/hichchi/blob/06777a67b73a055af108a17d7e01cf94eabb6608/libs/utils/src/lib/object.utils.ts#L125)
|
|
900
|
+
|
|
447
901
|
Groups an array of objects by a key.
|
|
448
902
|
|
|
449
903
|
#### Type Parameters
|
|
450
904
|
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
905
|
+
<table>
|
|
906
|
+
<thead>
|
|
907
|
+
<tr>
|
|
908
|
+
<th>Type Parameter</th>
|
|
909
|
+
<th>Description</th>
|
|
910
|
+
</tr>
|
|
911
|
+
</thead>
|
|
912
|
+
<tbody>
|
|
913
|
+
<tr>
|
|
914
|
+
<td>
|
|
915
|
+
|
|
916
|
+
`K`
|
|
917
|
+
|
|
918
|
+
</td>
|
|
919
|
+
<td>
|
|
920
|
+
|
|
921
|
+
Type of the key.
|
|
922
|
+
|
|
923
|
+
</td>
|
|
924
|
+
</tr>
|
|
925
|
+
<tr>
|
|
926
|
+
<td>
|
|
927
|
+
|
|
928
|
+
`V`
|
|
929
|
+
|
|
930
|
+
</td>
|
|
931
|
+
<td>
|
|
932
|
+
|
|
933
|
+
Type of the object.
|
|
934
|
+
|
|
935
|
+
</td>
|
|
936
|
+
</tr>
|
|
937
|
+
</tbody>
|
|
938
|
+
</table>
|
|
455
939
|
|
|
456
940
|
#### Parameters
|
|
457
941
|
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
942
|
+
<table>
|
|
943
|
+
<thead>
|
|
944
|
+
<tr>
|
|
945
|
+
<th>Parameter</th>
|
|
946
|
+
<th>Type</th>
|
|
947
|
+
<th>Description</th>
|
|
948
|
+
</tr>
|
|
949
|
+
</thead>
|
|
950
|
+
<tbody>
|
|
951
|
+
<tr>
|
|
952
|
+
<td>
|
|
953
|
+
|
|
954
|
+
`list`
|
|
955
|
+
|
|
956
|
+
</td>
|
|
957
|
+
<td>
|
|
958
|
+
|
|
959
|
+
`V`[]
|
|
960
|
+
|
|
961
|
+
</td>
|
|
962
|
+
<td>
|
|
963
|
+
|
|
964
|
+
Array of objects to group.
|
|
965
|
+
|
|
966
|
+
</td>
|
|
967
|
+
</tr>
|
|
968
|
+
<tr>
|
|
969
|
+
<td>
|
|
970
|
+
|
|
971
|
+
`keyGetter`
|
|
972
|
+
|
|
973
|
+
</td>
|
|
974
|
+
<td>
|
|
975
|
+
|
|
976
|
+
(`input`) => `K`
|
|
977
|
+
|
|
978
|
+
</td>
|
|
979
|
+
<td>
|
|
980
|
+
|
|
981
|
+
Function to get the key from the object.
|
|
982
|
+
|
|
983
|
+
</td>
|
|
984
|
+
</tr>
|
|
985
|
+
</tbody>
|
|
986
|
+
</table>
|
|
462
987
|
|
|
463
988
|
#### Returns
|
|
464
989
|
|
|
465
|
-
`Map`\<`K`, `V`[]\>
|
|
990
|
+
`Map`\<`null` \| `K`, `V`[]\>
|
|
466
991
|
|
|
467
992
|
Grouped objects.
|
|
468
993
|
|
|
@@ -495,25 +1020,48 @@ Map {
|
|
|
495
1020
|
}
|
|
496
1021
|
```
|
|
497
1022
|
|
|
498
|
-
#### Defined in
|
|
499
|
-
|
|
500
|
-
object.utils.ts:125
|
|
501
|
-
|
|
502
1023
|
---
|
|
503
1024
|
|
|
504
1025
|
### htmlToText()
|
|
505
1026
|
|
|
506
1027
|
```ts
|
|
507
|
-
function htmlToText(str
|
|
1028
|
+
function htmlToText(str): string;
|
|
508
1029
|
```
|
|
509
1030
|
|
|
1031
|
+
Defined in: [string.utils.ts:314](https://github.com/hichchidev/hichchi/blob/06777a67b73a055af108a17d7e01cf94eabb6608/libs/utils/src/lib/string.utils.ts#L314)
|
|
1032
|
+
|
|
510
1033
|
Remove HTML tags from a string and return plain text.
|
|
511
1034
|
|
|
512
1035
|
#### Parameters
|
|
513
1036
|
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
1037
|
+
<table>
|
|
1038
|
+
<thead>
|
|
1039
|
+
<tr>
|
|
1040
|
+
<th>Parameter</th>
|
|
1041
|
+
<th>Type</th>
|
|
1042
|
+
<th>Description</th>
|
|
1043
|
+
</tr>
|
|
1044
|
+
</thead>
|
|
1045
|
+
<tbody>
|
|
1046
|
+
<tr>
|
|
1047
|
+
<td>
|
|
1048
|
+
|
|
1049
|
+
`str`
|
|
1050
|
+
|
|
1051
|
+
</td>
|
|
1052
|
+
<td>
|
|
1053
|
+
|
|
1054
|
+
`string`
|
|
1055
|
+
|
|
1056
|
+
</td>
|
|
1057
|
+
<td>
|
|
1058
|
+
|
|
1059
|
+
String to remove HTML tags from.
|
|
1060
|
+
|
|
1061
|
+
</td>
|
|
1062
|
+
</tr>
|
|
1063
|
+
</tbody>
|
|
1064
|
+
</table>
|
|
517
1065
|
|
|
518
1066
|
#### Returns
|
|
519
1067
|
|
|
@@ -527,31 +1075,73 @@ Plain text.
|
|
|
527
1075
|
htmlToText("<h1>Hello World</h1>"); // "Hello World"
|
|
528
1076
|
```
|
|
529
1077
|
|
|
530
|
-
#### Defined in
|
|
531
|
-
|
|
532
|
-
string.utils.ts:305
|
|
533
|
-
|
|
534
1078
|
---
|
|
535
1079
|
|
|
536
1080
|
### isArray()
|
|
537
1081
|
|
|
538
1082
|
```ts
|
|
539
|
-
function isArray<T>(value
|
|
1083
|
+
function isArray<T>(value): value is T[];
|
|
540
1084
|
```
|
|
541
1085
|
|
|
1086
|
+
Defined in: [assertions.utils.ts:20](https://github.com/hichchidev/hichchi/blob/06777a67b73a055af108a17d7e01cf94eabb6608/libs/utils/src/lib/assertions.utils.ts#L20)
|
|
1087
|
+
|
|
542
1088
|
Check if the value is an array while asserting it's an array of generic type T
|
|
543
1089
|
|
|
544
1090
|
#### Type Parameters
|
|
545
1091
|
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
1092
|
+
<table>
|
|
1093
|
+
<thead>
|
|
1094
|
+
<tr>
|
|
1095
|
+
<th>Type Parameter</th>
|
|
1096
|
+
<th>Description</th>
|
|
1097
|
+
</tr>
|
|
1098
|
+
</thead>
|
|
1099
|
+
<tbody>
|
|
1100
|
+
<tr>
|
|
1101
|
+
<td>
|
|
1102
|
+
|
|
1103
|
+
`T`
|
|
1104
|
+
|
|
1105
|
+
</td>
|
|
1106
|
+
<td>
|
|
1107
|
+
|
|
1108
|
+
The type of the array
|
|
1109
|
+
|
|
1110
|
+
</td>
|
|
1111
|
+
</tr>
|
|
1112
|
+
</tbody>
|
|
1113
|
+
</table>
|
|
549
1114
|
|
|
550
1115
|
#### Parameters
|
|
551
1116
|
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
1117
|
+
<table>
|
|
1118
|
+
<thead>
|
|
1119
|
+
<tr>
|
|
1120
|
+
<th>Parameter</th>
|
|
1121
|
+
<th>Type</th>
|
|
1122
|
+
<th>Description</th>
|
|
1123
|
+
</tr>
|
|
1124
|
+
</thead>
|
|
1125
|
+
<tbody>
|
|
1126
|
+
<tr>
|
|
1127
|
+
<td>
|
|
1128
|
+
|
|
1129
|
+
`value`
|
|
1130
|
+
|
|
1131
|
+
</td>
|
|
1132
|
+
<td>
|
|
1133
|
+
|
|
1134
|
+
`undefined` \| `T` \| `T`[]
|
|
1135
|
+
|
|
1136
|
+
</td>
|
|
1137
|
+
<td>
|
|
1138
|
+
|
|
1139
|
+
The value to check
|
|
1140
|
+
|
|
1141
|
+
</td>
|
|
1142
|
+
</tr>
|
|
1143
|
+
</tbody>
|
|
1144
|
+
</table>
|
|
555
1145
|
|
|
556
1146
|
#### Returns
|
|
557
1147
|
|
|
@@ -563,39 +1153,81 @@ True if the value is an array, false otherwise
|
|
|
563
1153
|
|
|
564
1154
|
```TypeScript
|
|
565
1155
|
async function createUser(userOrUsers: UserDto | UserDto[] | undefined): User {
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
1156
|
+
if (isArray<UserDto>(userOrUsers)) {
|
|
1157
|
+
return userOrUsers.map(async user => await userService.createUser(user));
|
|
1158
|
+
} else {
|
|
1159
|
+
return await userService.createUser(userOrUsers);
|
|
1160
|
+
}
|
|
571
1161
|
}
|
|
572
1162
|
```
|
|
573
1163
|
|
|
574
|
-
#### Defined in
|
|
575
|
-
|
|
576
|
-
assertions.utils.ts:21
|
|
577
|
-
|
|
578
1164
|
---
|
|
579
1165
|
|
|
580
1166
|
### isObject()
|
|
581
1167
|
|
|
582
1168
|
```ts
|
|
583
|
-
function isObject<T>(value
|
|
1169
|
+
function isObject<T>(value?): value is T;
|
|
584
1170
|
```
|
|
585
1171
|
|
|
1172
|
+
Defined in: [assertions.utils.ts:41](https://github.com/hichchidev/hichchi/blob/06777a67b73a055af108a17d7e01cf94eabb6608/libs/utils/src/lib/assertions.utils.ts#L41)
|
|
1173
|
+
|
|
586
1174
|
Check if the value is an object while asserting it's an object of generic type T
|
|
587
1175
|
|
|
588
1176
|
#### Type Parameters
|
|
589
1177
|
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
1178
|
+
<table>
|
|
1179
|
+
<thead>
|
|
1180
|
+
<tr>
|
|
1181
|
+
<th>Type Parameter</th>
|
|
1182
|
+
<th>Description</th>
|
|
1183
|
+
</tr>
|
|
1184
|
+
</thead>
|
|
1185
|
+
<tbody>
|
|
1186
|
+
<tr>
|
|
1187
|
+
<td>
|
|
1188
|
+
|
|
1189
|
+
`T`
|
|
1190
|
+
|
|
1191
|
+
</td>
|
|
1192
|
+
<td>
|
|
1193
|
+
|
|
1194
|
+
The type of the object
|
|
1195
|
+
|
|
1196
|
+
</td>
|
|
1197
|
+
</tr>
|
|
1198
|
+
</tbody>
|
|
1199
|
+
</table>
|
|
593
1200
|
|
|
594
1201
|
#### Parameters
|
|
595
1202
|
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
1203
|
+
<table>
|
|
1204
|
+
<thead>
|
|
1205
|
+
<tr>
|
|
1206
|
+
<th>Parameter</th>
|
|
1207
|
+
<th>Type</th>
|
|
1208
|
+
<th>Description</th>
|
|
1209
|
+
</tr>
|
|
1210
|
+
</thead>
|
|
1211
|
+
<tbody>
|
|
1212
|
+
<tr>
|
|
1213
|
+
<td>
|
|
1214
|
+
|
|
1215
|
+
`value?`
|
|
1216
|
+
|
|
1217
|
+
</td>
|
|
1218
|
+
<td>
|
|
1219
|
+
|
|
1220
|
+
`T` \| `T`[]
|
|
1221
|
+
|
|
1222
|
+
</td>
|
|
1223
|
+
<td>
|
|
1224
|
+
|
|
1225
|
+
The value to check
|
|
1226
|
+
|
|
1227
|
+
</td>
|
|
1228
|
+
</tr>
|
|
1229
|
+
</tbody>
|
|
1230
|
+
</table>
|
|
599
1231
|
|
|
600
1232
|
#### Returns
|
|
601
1233
|
|
|
@@ -606,41 +1238,99 @@ True if the value is an object, false otherwise
|
|
|
606
1238
|
#### Example
|
|
607
1239
|
|
|
608
1240
|
```TypeScript
|
|
609
|
-
async function getUserInfo(userIdOrUser:
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
1241
|
+
async function getUserInfo(userIdOrUser: EntityId | User | undefined): UserInfo {
|
|
1242
|
+
if (isObject<User>(userIdOrUser)) {
|
|
1243
|
+
return await userService.getUserInfo(userIdOrUser.id);
|
|
1244
|
+
} else {
|
|
1245
|
+
return await userService.getUserInfo(userIdOrUser);
|
|
1246
|
+
}
|
|
615
1247
|
}
|
|
616
1248
|
```
|
|
617
1249
|
|
|
618
|
-
#### Defined in
|
|
619
|
-
|
|
620
|
-
assertions.utils.ts:42
|
|
621
|
-
|
|
622
1250
|
---
|
|
623
1251
|
|
|
624
1252
|
### isObjectWith()
|
|
625
1253
|
|
|
626
1254
|
```ts
|
|
627
|
-
function isObjectWith<T>(value
|
|
1255
|
+
function isObjectWith<T>(value, propertyName): value is T;
|
|
628
1256
|
```
|
|
629
1257
|
|
|
1258
|
+
Defined in: [assertions.utils.ts:63](https://github.com/hichchidev/hichchi/blob/06777a67b73a055af108a17d7e01cf94eabb6608/libs/utils/src/lib/assertions.utils.ts#L63)
|
|
1259
|
+
|
|
630
1260
|
Check if the value is an object with a given property name and asset it's an object of generic type T
|
|
631
1261
|
|
|
632
1262
|
#### Type Parameters
|
|
633
1263
|
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
1264
|
+
<table>
|
|
1265
|
+
<thead>
|
|
1266
|
+
<tr>
|
|
1267
|
+
<th>Type Parameter</th>
|
|
1268
|
+
<th>Description</th>
|
|
1269
|
+
</tr>
|
|
1270
|
+
</thead>
|
|
1271
|
+
<tbody>
|
|
1272
|
+
<tr>
|
|
1273
|
+
<td>
|
|
1274
|
+
|
|
1275
|
+
`T` _extends_ `object`
|
|
1276
|
+
|
|
1277
|
+
</td>
|
|
1278
|
+
<td>
|
|
1279
|
+
|
|
1280
|
+
The type of the object
|
|
1281
|
+
|
|
1282
|
+
</td>
|
|
1283
|
+
</tr>
|
|
1284
|
+
</tbody>
|
|
1285
|
+
</table>
|
|
637
1286
|
|
|
638
1287
|
#### Parameters
|
|
639
1288
|
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
1289
|
+
<table>
|
|
1290
|
+
<thead>
|
|
1291
|
+
<tr>
|
|
1292
|
+
<th>Parameter</th>
|
|
1293
|
+
<th>Type</th>
|
|
1294
|
+
<th>Description</th>
|
|
1295
|
+
</tr>
|
|
1296
|
+
</thead>
|
|
1297
|
+
<tbody>
|
|
1298
|
+
<tr>
|
|
1299
|
+
<td>
|
|
1300
|
+
|
|
1301
|
+
`value`
|
|
1302
|
+
|
|
1303
|
+
</td>
|
|
1304
|
+
<td>
|
|
1305
|
+
|
|
1306
|
+
`unknown`
|
|
1307
|
+
|
|
1308
|
+
</td>
|
|
1309
|
+
<td>
|
|
1310
|
+
|
|
1311
|
+
The value to check
|
|
1312
|
+
|
|
1313
|
+
</td>
|
|
1314
|
+
</tr>
|
|
1315
|
+
<tr>
|
|
1316
|
+
<td>
|
|
1317
|
+
|
|
1318
|
+
`propertyName`
|
|
1319
|
+
|
|
1320
|
+
</td>
|
|
1321
|
+
<td>
|
|
1322
|
+
|
|
1323
|
+
keyof `T`
|
|
1324
|
+
|
|
1325
|
+
</td>
|
|
1326
|
+
<td>
|
|
1327
|
+
|
|
1328
|
+
The property name to check
|
|
1329
|
+
|
|
1330
|
+
</td>
|
|
1331
|
+
</tr>
|
|
1332
|
+
</tbody>
|
|
1333
|
+
</table>
|
|
644
1334
|
|
|
645
1335
|
#### Returns
|
|
646
1336
|
|
|
@@ -651,38 +1341,61 @@ True if the value is an object with the given property name, false otherwise
|
|
|
651
1341
|
#### Example
|
|
652
1342
|
|
|
653
1343
|
```TypeScript
|
|
654
|
-
async function getUserInfo(userIdOrUser:
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
1344
|
+
async function getUserInfo(userIdOrUser: EntityId | User | undefined): UserInfo {
|
|
1345
|
+
if (isObjectWith<User>(userIdOrUser, "id")) {
|
|
1346
|
+
return await userService.getUserInfo(userIdOrUser.id);
|
|
1347
|
+
} else {
|
|
1348
|
+
return await userService.getUserInfo(userIdOrUser);
|
|
1349
|
+
}
|
|
660
1350
|
}
|
|
661
1351
|
```
|
|
662
1352
|
|
|
663
|
-
#### Defined in
|
|
664
|
-
|
|
665
|
-
assertions.utils.ts:64
|
|
666
|
-
|
|
667
1353
|
---
|
|
668
1354
|
|
|
669
1355
|
### objectToPathValueSet()
|
|
670
1356
|
|
|
671
1357
|
```ts
|
|
672
|
-
function objectToPathValueSet(obj
|
|
1358
|
+
function objectToPathValueSet(obj): PathValueSet;
|
|
673
1359
|
```
|
|
674
1360
|
|
|
1361
|
+
Defined in: [object.utils.ts:256](https://github.com/hichchidev/hichchi/blob/06777a67b73a055af108a17d7e01cf94eabb6608/libs/utils/src/lib/object.utils.ts#L256)
|
|
1362
|
+
|
|
675
1363
|
Convert an object to a path value set
|
|
676
1364
|
|
|
677
1365
|
#### Parameters
|
|
678
1366
|
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
1367
|
+
<table>
|
|
1368
|
+
<thead>
|
|
1369
|
+
<tr>
|
|
1370
|
+
<th>Parameter</th>
|
|
1371
|
+
<th>Type</th>
|
|
1372
|
+
<th>Description</th>
|
|
1373
|
+
</tr>
|
|
1374
|
+
</thead>
|
|
1375
|
+
<tbody>
|
|
1376
|
+
<tr>
|
|
1377
|
+
<td>
|
|
1378
|
+
|
|
1379
|
+
`obj`
|
|
1380
|
+
|
|
1381
|
+
</td>
|
|
1382
|
+
<td>
|
|
1383
|
+
|
|
1384
|
+
[`LiteralObject`](#literalobject)
|
|
1385
|
+
|
|
1386
|
+
</td>
|
|
1387
|
+
<td>
|
|
1388
|
+
|
|
1389
|
+
The object
|
|
1390
|
+
|
|
1391
|
+
</td>
|
|
1392
|
+
</tr>
|
|
1393
|
+
</tbody>
|
|
1394
|
+
</table>
|
|
682
1395
|
|
|
683
1396
|
#### Returns
|
|
684
1397
|
|
|
685
|
-
[`PathValueSet`](
|
|
1398
|
+
[`PathValueSet`](#pathvalueset)
|
|
686
1399
|
|
|
687
1400
|
The path value set
|
|
688
1401
|
|
|
@@ -712,36 +1425,94 @@ const pathValueSet = objectToPathValueSet(object);
|
|
|
712
1425
|
}
|
|
713
1426
|
```
|
|
714
1427
|
|
|
715
|
-
|
|
1428
|
+
---
|
|
1429
|
+
|
|
1430
|
+
### omit()
|
|
1431
|
+
|
|
1432
|
+
```ts
|
|
1433
|
+
function omit<T>(obj, keys?): Partial<T>;
|
|
1434
|
+
```
|
|
1435
|
+
|
|
1436
|
+
Defined in: [object.utils.ts:374](https://github.com/hichchidev/hichchi/blob/06777a67b73a055af108a17d7e01cf94eabb6608/libs/utils/src/lib/object.utils.ts#L374)
|
|
1437
|
+
|
|
1438
|
+
Omits undefined properties and properties in the keys array from an object.
|
|
1439
|
+
|
|
1440
|
+
#### Type Parameters
|
|
1441
|
+
|
|
1442
|
+
<table>
|
|
1443
|
+
<thead>
|
|
1444
|
+
<tr>
|
|
1445
|
+
<th>Type Parameter</th>
|
|
1446
|
+
<th>Description</th>
|
|
1447
|
+
</tr>
|
|
1448
|
+
</thead>
|
|
1449
|
+
<tbody>
|
|
1450
|
+
<tr>
|
|
1451
|
+
<td>
|
|
1452
|
+
|
|
1453
|
+
`T` _extends_ `object`
|
|
1454
|
+
|
|
1455
|
+
</td>
|
|
1456
|
+
<td>
|
|
1457
|
+
|
|
1458
|
+
Type of the object.
|
|
1459
|
+
|
|
1460
|
+
</td>
|
|
1461
|
+
</tr>
|
|
1462
|
+
</tbody>
|
|
1463
|
+
</table>
|
|
1464
|
+
|
|
1465
|
+
#### Parameters
|
|
1466
|
+
|
|
1467
|
+
<table>
|
|
1468
|
+
<thead>
|
|
1469
|
+
<tr>
|
|
1470
|
+
<th>Parameter</th>
|
|
1471
|
+
<th>Type</th>
|
|
1472
|
+
<th>Description</th>
|
|
1473
|
+
</tr>
|
|
1474
|
+
</thead>
|
|
1475
|
+
<tbody>
|
|
1476
|
+
<tr>
|
|
1477
|
+
<td>
|
|
1478
|
+
|
|
1479
|
+
`obj`
|
|
716
1480
|
|
|
717
|
-
|
|
1481
|
+
</td>
|
|
1482
|
+
<td>
|
|
718
1483
|
|
|
719
|
-
|
|
1484
|
+
`Partial`\<`T`\>
|
|
720
1485
|
|
|
721
|
-
|
|
1486
|
+
</td>
|
|
1487
|
+
<td>
|
|
722
1488
|
|
|
723
|
-
|
|
724
|
-
function omit<T>(obj: Partial<T>, keys?: keyof T[]): void;
|
|
725
|
-
```
|
|
1489
|
+
Object to omit properties from.
|
|
726
1490
|
|
|
727
|
-
|
|
1491
|
+
</td>
|
|
1492
|
+
</tr>
|
|
1493
|
+
<tr>
|
|
1494
|
+
<td>
|
|
728
1495
|
|
|
729
|
-
|
|
1496
|
+
`keys?`
|
|
730
1497
|
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
| `T` _extends_ \{\} |
|
|
1498
|
+
</td>
|
|
1499
|
+
<td>
|
|
734
1500
|
|
|
735
|
-
|
|
1501
|
+
keyof `T`[]
|
|
1502
|
+
|
|
1503
|
+
</td>
|
|
1504
|
+
<td>
|
|
736
1505
|
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
1506
|
+
Array of keys to omit.
|
|
1507
|
+
|
|
1508
|
+
</td>
|
|
1509
|
+
</tr>
|
|
1510
|
+
</tbody>
|
|
1511
|
+
</table>
|
|
741
1512
|
|
|
742
1513
|
#### Returns
|
|
743
1514
|
|
|
744
|
-
`
|
|
1515
|
+
`Partial`\<`T`\>
|
|
745
1516
|
|
|
746
1517
|
- Object with omitted properties.
|
|
747
1518
|
|
|
@@ -765,31 +1536,79 @@ omit(object, ["role"]);
|
|
|
765
1536
|
}
|
|
766
1537
|
```
|
|
767
1538
|
|
|
768
|
-
#### Defined in
|
|
769
|
-
|
|
770
|
-
object.utils.ts:370
|
|
771
|
-
|
|
772
1539
|
---
|
|
773
1540
|
|
|
774
1541
|
### pathValueSetToObject()
|
|
775
1542
|
|
|
776
1543
|
```ts
|
|
777
|
-
function pathValueSetToObject<R>(pathValueSet
|
|
1544
|
+
function pathValueSetToObject<R>(pathValueSet): R;
|
|
778
1545
|
```
|
|
779
1546
|
|
|
1547
|
+
Defined in: [object.utils.ts:309](https://github.com/hichchidev/hichchi/blob/06777a67b73a055af108a17d7e01cf94eabb6608/libs/utils/src/lib/object.utils.ts#L309)
|
|
1548
|
+
|
|
780
1549
|
Convert the path value set to an object
|
|
781
1550
|
|
|
782
1551
|
#### Type Parameters
|
|
783
1552
|
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
1553
|
+
<table>
|
|
1554
|
+
<thead>
|
|
1555
|
+
<tr>
|
|
1556
|
+
<th>Type Parameter</th>
|
|
1557
|
+
<th>Default type</th>
|
|
1558
|
+
<th>Description</th>
|
|
1559
|
+
</tr>
|
|
1560
|
+
</thead>
|
|
1561
|
+
<tbody>
|
|
1562
|
+
<tr>
|
|
1563
|
+
<td>
|
|
1564
|
+
|
|
1565
|
+
`R`
|
|
1566
|
+
|
|
1567
|
+
</td>
|
|
1568
|
+
<td>
|
|
1569
|
+
|
|
1570
|
+
`object`
|
|
1571
|
+
|
|
1572
|
+
</td>
|
|
1573
|
+
<td>
|
|
1574
|
+
|
|
1575
|
+
The return type
|
|
1576
|
+
|
|
1577
|
+
</td>
|
|
1578
|
+
</tr>
|
|
1579
|
+
</tbody>
|
|
1580
|
+
</table>
|
|
787
1581
|
|
|
788
1582
|
#### Parameters
|
|
789
1583
|
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
1584
|
+
<table>
|
|
1585
|
+
<thead>
|
|
1586
|
+
<tr>
|
|
1587
|
+
<th>Parameter</th>
|
|
1588
|
+
<th>Type</th>
|
|
1589
|
+
<th>Description</th>
|
|
1590
|
+
</tr>
|
|
1591
|
+
</thead>
|
|
1592
|
+
<tbody>
|
|
1593
|
+
<tr>
|
|
1594
|
+
<td>
|
|
1595
|
+
|
|
1596
|
+
`pathValueSet`
|
|
1597
|
+
|
|
1598
|
+
</td>
|
|
1599
|
+
<td>
|
|
1600
|
+
|
|
1601
|
+
`Record`\<`string`, `any`\>
|
|
1602
|
+
|
|
1603
|
+
</td>
|
|
1604
|
+
<td>
|
|
1605
|
+
|
|
1606
|
+
The path value set
|
|
1607
|
+
|
|
1608
|
+
</td>
|
|
1609
|
+
</tr>
|
|
1610
|
+
</tbody>
|
|
1611
|
+
</table>
|
|
793
1612
|
|
|
794
1613
|
#### Returns
|
|
795
1614
|
|
|
@@ -823,32 +1642,90 @@ const object = pathValueSetToObject(pathValueSet);
|
|
|
823
1642
|
}
|
|
824
1643
|
```
|
|
825
1644
|
|
|
826
|
-
#### Defined in
|
|
827
|
-
|
|
828
|
-
object.utils.ts:308
|
|
829
|
-
|
|
830
1645
|
---
|
|
831
1646
|
|
|
832
1647
|
### prune()
|
|
833
1648
|
|
|
834
1649
|
```ts
|
|
835
|
-
function prune<T>(obj
|
|
1650
|
+
function prune<T>(obj, omitPrototype?): T;
|
|
836
1651
|
```
|
|
837
1652
|
|
|
1653
|
+
Defined in: [object.utils.ts:403](https://github.com/hichchidev/hichchi/blob/06777a67b73a055af108a17d7e01cf94eabb6608/libs/utils/src/lib/object.utils.ts#L403)
|
|
1654
|
+
|
|
838
1655
|
Prune an object by removing all empty, null, undefined, and prototype properties.
|
|
839
1656
|
|
|
840
1657
|
#### Type Parameters
|
|
841
1658
|
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
1659
|
+
<table>
|
|
1660
|
+
<thead>
|
|
1661
|
+
<tr>
|
|
1662
|
+
<th>Type Parameter</th>
|
|
1663
|
+
<th>Description</th>
|
|
1664
|
+
</tr>
|
|
1665
|
+
</thead>
|
|
1666
|
+
<tbody>
|
|
1667
|
+
<tr>
|
|
1668
|
+
<td>
|
|
1669
|
+
|
|
1670
|
+
`T`
|
|
1671
|
+
|
|
1672
|
+
</td>
|
|
1673
|
+
<td>
|
|
1674
|
+
|
|
1675
|
+
Type of the object.
|
|
1676
|
+
|
|
1677
|
+
</td>
|
|
1678
|
+
</tr>
|
|
1679
|
+
</tbody>
|
|
1680
|
+
</table>
|
|
845
1681
|
|
|
846
1682
|
#### Parameters
|
|
847
1683
|
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
1684
|
+
<table>
|
|
1685
|
+
<thead>
|
|
1686
|
+
<tr>
|
|
1687
|
+
<th>Parameter</th>
|
|
1688
|
+
<th>Type</th>
|
|
1689
|
+
<th>Description</th>
|
|
1690
|
+
</tr>
|
|
1691
|
+
</thead>
|
|
1692
|
+
<tbody>
|
|
1693
|
+
<tr>
|
|
1694
|
+
<td>
|
|
1695
|
+
|
|
1696
|
+
`obj`
|
|
1697
|
+
|
|
1698
|
+
</td>
|
|
1699
|
+
<td>
|
|
1700
|
+
|
|
1701
|
+
[`PartialWithNull`](#partialwithnull)\<`T`\>
|
|
1702
|
+
|
|
1703
|
+
</td>
|
|
1704
|
+
<td>
|
|
1705
|
+
|
|
1706
|
+
Object to prune.
|
|
1707
|
+
|
|
1708
|
+
</td>
|
|
1709
|
+
</tr>
|
|
1710
|
+
<tr>
|
|
1711
|
+
<td>
|
|
1712
|
+
|
|
1713
|
+
`omitPrototype?`
|
|
1714
|
+
|
|
1715
|
+
</td>
|
|
1716
|
+
<td>
|
|
1717
|
+
|
|
1718
|
+
`boolean`
|
|
1719
|
+
|
|
1720
|
+
</td>
|
|
1721
|
+
<td>
|
|
1722
|
+
|
|
1723
|
+
Omit prototype properties.
|
|
1724
|
+
|
|
1725
|
+
</td>
|
|
1726
|
+
</tr>
|
|
1727
|
+
</tbody>
|
|
1728
|
+
</table>
|
|
852
1729
|
|
|
853
1730
|
#### Returns
|
|
854
1731
|
|
|
@@ -870,26 +1747,65 @@ const object = {
|
|
|
870
1747
|
},
|
|
871
1748
|
};
|
|
872
1749
|
|
|
873
|
-
#### Defined in
|
|
874
|
-
|
|
875
|
-
object.utils.ts:398
|
|
876
|
-
|
|
877
1750
|
***
|
|
878
1751
|
|
|
879
1752
|
### saveAsFile()
|
|
880
1753
|
|
|
881
1754
|
```ts
|
|
882
|
-
function saveAsFile(blob
|
|
1755
|
+
function saveAsFile(blob, filename): void;
|
|
883
1756
|
````
|
|
884
1757
|
|
|
1758
|
+
Defined in: [file.utils.ts:1252](https://github.com/hichchidev/hichchi/blob/06777a67b73a055af108a17d7e01cf94eabb6608/libs/utils/src/lib/file.utils.ts#L1252)
|
|
1759
|
+
|
|
885
1760
|
Save a StreamableBlob as a file.
|
|
886
1761
|
|
|
887
1762
|
#### Parameters
|
|
888
1763
|
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
1764
|
+
<table>
|
|
1765
|
+
<thead>
|
|
1766
|
+
<tr>
|
|
1767
|
+
<th>Parameter</th>
|
|
1768
|
+
<th>Type</th>
|
|
1769
|
+
<th>Description</th>
|
|
1770
|
+
</tr>
|
|
1771
|
+
</thead>
|
|
1772
|
+
<tbody>
|
|
1773
|
+
<tr>
|
|
1774
|
+
<td>
|
|
1775
|
+
|
|
1776
|
+
`blob`
|
|
1777
|
+
|
|
1778
|
+
</td>
|
|
1779
|
+
<td>
|
|
1780
|
+
|
|
1781
|
+
`Blob`
|
|
1782
|
+
|
|
1783
|
+
</td>
|
|
1784
|
+
<td>
|
|
1785
|
+
|
|
1786
|
+
Blob to save.
|
|
1787
|
+
|
|
1788
|
+
</td>
|
|
1789
|
+
</tr>
|
|
1790
|
+
<tr>
|
|
1791
|
+
<td>
|
|
1792
|
+
|
|
1793
|
+
`filename`
|
|
1794
|
+
|
|
1795
|
+
</td>
|
|
1796
|
+
<td>
|
|
1797
|
+
|
|
1798
|
+
`string`
|
|
1799
|
+
|
|
1800
|
+
</td>
|
|
1801
|
+
<td>
|
|
1802
|
+
|
|
1803
|
+
File name.
|
|
1804
|
+
|
|
1805
|
+
</td>
|
|
1806
|
+
</tr>
|
|
1807
|
+
</tbody>
|
|
1808
|
+
</table>
|
|
893
1809
|
|
|
894
1810
|
#### Returns
|
|
895
1811
|
|
|
@@ -899,29 +1815,65 @@ Save a StreamableBlob as a file.
|
|
|
899
1815
|
|
|
900
1816
|
- Throws an error if used in a Node.js environment.
|
|
901
1817
|
|
|
902
|
-
#### Defined in
|
|
903
|
-
|
|
904
|
-
file.utils.ts:1246
|
|
905
|
-
|
|
906
1818
|
---
|
|
907
1819
|
|
|
908
1820
|
### searchMapValues()
|
|
909
1821
|
|
|
910
1822
|
```ts
|
|
911
|
-
function searchMapValues(
|
|
912
|
-
map: Map<string, string>,
|
|
913
|
-
partialValue: string,
|
|
914
|
-
): string[];
|
|
1823
|
+
function searchMapValues(map, partialValue): string[];
|
|
915
1824
|
```
|
|
916
1825
|
|
|
1826
|
+
Defined in: [object.utils.ts:160](https://github.com/hichchidev/hichchi/blob/06777a67b73a055af108a17d7e01cf94eabb6608/libs/utils/src/lib/object.utils.ts#L160)
|
|
1827
|
+
|
|
917
1828
|
Get the values of a map by partial value.
|
|
918
1829
|
|
|
919
1830
|
#### Parameters
|
|
920
1831
|
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
1832
|
+
<table>
|
|
1833
|
+
<thead>
|
|
1834
|
+
<tr>
|
|
1835
|
+
<th>Parameter</th>
|
|
1836
|
+
<th>Type</th>
|
|
1837
|
+
<th>Description</th>
|
|
1838
|
+
</tr>
|
|
1839
|
+
</thead>
|
|
1840
|
+
<tbody>
|
|
1841
|
+
<tr>
|
|
1842
|
+
<td>
|
|
1843
|
+
|
|
1844
|
+
`map`
|
|
1845
|
+
|
|
1846
|
+
</td>
|
|
1847
|
+
<td>
|
|
1848
|
+
|
|
1849
|
+
`Map`\<`string`, `string`\>
|
|
1850
|
+
|
|
1851
|
+
</td>
|
|
1852
|
+
<td>
|
|
1853
|
+
|
|
1854
|
+
Map to get values from.
|
|
1855
|
+
|
|
1856
|
+
</td>
|
|
1857
|
+
</tr>
|
|
1858
|
+
<tr>
|
|
1859
|
+
<td>
|
|
1860
|
+
|
|
1861
|
+
`partialValue`
|
|
1862
|
+
|
|
1863
|
+
</td>
|
|
1864
|
+
<td>
|
|
1865
|
+
|
|
1866
|
+
`string`
|
|
1867
|
+
|
|
1868
|
+
</td>
|
|
1869
|
+
<td>
|
|
1870
|
+
|
|
1871
|
+
Partial value to get values for.
|
|
1872
|
+
|
|
1873
|
+
</td>
|
|
1874
|
+
</tr>
|
|
1875
|
+
</tbody>
|
|
1876
|
+
</table>
|
|
925
1877
|
|
|
926
1878
|
#### Returns
|
|
927
1879
|
|
|
@@ -934,36 +1886,59 @@ Values of the map.
|
|
|
934
1886
|
```TypeScript
|
|
935
1887
|
// Example usage
|
|
936
1888
|
const user = new Map<string, string>([
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
1889
|
+
["name", "John Doe"],
|
|
1890
|
+
["preferredName", "John"],
|
|
1891
|
+
["age", 30],
|
|
940
1892
|
]);
|
|
941
1893
|
|
|
942
1894
|
const values = getMapValues(user, "Jo");
|
|
943
1895
|
|
|
944
1896
|
// Example output
|
|
945
|
-
["John Doe", "John"]
|
|
1897
|
+
["John Doe", "John"]
|
|
946
1898
|
```
|
|
947
1899
|
|
|
948
|
-
#### Defined in
|
|
949
|
-
|
|
950
|
-
object.utils.ts:160
|
|
951
|
-
|
|
952
1900
|
---
|
|
953
1901
|
|
|
954
1902
|
### singular()
|
|
955
1903
|
|
|
956
1904
|
```ts
|
|
957
|
-
function singular(str
|
|
1905
|
+
function singular(str): string;
|
|
958
1906
|
```
|
|
959
1907
|
|
|
1908
|
+
Defined in: [string.utils.ts:328](https://github.com/hichchidev/hichchi/blob/06777a67b73a055af108a17d7e01cf94eabb6608/libs/utils/src/lib/string.utils.ts#L328)
|
|
1909
|
+
|
|
960
1910
|
Handles converting plural words to their singular form.
|
|
961
1911
|
|
|
962
1912
|
#### Parameters
|
|
963
1913
|
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
1914
|
+
<table>
|
|
1915
|
+
<thead>
|
|
1916
|
+
<tr>
|
|
1917
|
+
<th>Parameter</th>
|
|
1918
|
+
<th>Type</th>
|
|
1919
|
+
<th>Description</th>
|
|
1920
|
+
</tr>
|
|
1921
|
+
</thead>
|
|
1922
|
+
<tbody>
|
|
1923
|
+
<tr>
|
|
1924
|
+
<td>
|
|
1925
|
+
|
|
1926
|
+
`str`
|
|
1927
|
+
|
|
1928
|
+
</td>
|
|
1929
|
+
<td>
|
|
1930
|
+
|
|
1931
|
+
`string`
|
|
1932
|
+
|
|
1933
|
+
</td>
|
|
1934
|
+
<td>
|
|
1935
|
+
|
|
1936
|
+
String to convert to singular.
|
|
1937
|
+
|
|
1938
|
+
</td>
|
|
1939
|
+
</tr>
|
|
1940
|
+
</tbody>
|
|
1941
|
+
</table>
|
|
967
1942
|
|
|
968
1943
|
#### Returns
|
|
969
1944
|
|
|
@@ -977,25 +1952,48 @@ Singular form of the string.
|
|
|
977
1952
|
singular("children"); // "child"
|
|
978
1953
|
```
|
|
979
1954
|
|
|
980
|
-
#### Defined in
|
|
981
|
-
|
|
982
|
-
string.utils.ts:319
|
|
983
|
-
|
|
984
1955
|
---
|
|
985
1956
|
|
|
986
1957
|
### toCamelCase()
|
|
987
1958
|
|
|
988
1959
|
```ts
|
|
989
|
-
function toCamelCase(str
|
|
1960
|
+
function toCamelCase(str?): string;
|
|
990
1961
|
```
|
|
991
1962
|
|
|
1963
|
+
Defined in: [string.utils.ts:197](https://github.com/hichchidev/hichchi/blob/06777a67b73a055af108a17d7e01cf94eabb6608/libs/utils/src/lib/string.utils.ts#L197)
|
|
1964
|
+
|
|
992
1965
|
Convert a string to camel case.
|
|
993
1966
|
|
|
994
1967
|
#### Parameters
|
|
995
1968
|
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
1969
|
+
<table>
|
|
1970
|
+
<thead>
|
|
1971
|
+
<tr>
|
|
1972
|
+
<th>Parameter</th>
|
|
1973
|
+
<th>Type</th>
|
|
1974
|
+
<th>Description</th>
|
|
1975
|
+
</tr>
|
|
1976
|
+
</thead>
|
|
1977
|
+
<tbody>
|
|
1978
|
+
<tr>
|
|
1979
|
+
<td>
|
|
1980
|
+
|
|
1981
|
+
`str?`
|
|
1982
|
+
|
|
1983
|
+
</td>
|
|
1984
|
+
<td>
|
|
1985
|
+
|
|
1986
|
+
`string`
|
|
1987
|
+
|
|
1988
|
+
</td>
|
|
1989
|
+
<td>
|
|
1990
|
+
|
|
1991
|
+
String to convert to camel case.
|
|
1992
|
+
|
|
1993
|
+
</td>
|
|
1994
|
+
</tr>
|
|
1995
|
+
</tbody>
|
|
1996
|
+
</table>
|
|
999
1997
|
|
|
1000
1998
|
#### Returns
|
|
1001
1999
|
|
|
@@ -1009,25 +2007,48 @@ String in camel case.
|
|
|
1009
2007
|
toCamelCase("hello world"); // "helloWorld"
|
|
1010
2008
|
```
|
|
1011
2009
|
|
|
1012
|
-
#### Defined in
|
|
1013
|
-
|
|
1014
|
-
string.utils.ts:188
|
|
1015
|
-
|
|
1016
2010
|
---
|
|
1017
2011
|
|
|
1018
2012
|
### toFirstCase()
|
|
1019
2013
|
|
|
1020
2014
|
```ts
|
|
1021
|
-
function toFirstCase(str
|
|
2015
|
+
function toFirstCase(str?): string;
|
|
1022
2016
|
```
|
|
1023
2017
|
|
|
2018
|
+
Defined in: [string.utils.ts:152](https://github.com/hichchidev/hichchi/blob/06777a67b73a055af108a17d7e01cf94eabb6608/libs/utils/src/lib/string.utils.ts#L152)
|
|
2019
|
+
|
|
1024
2020
|
Convert a string to first case (Capitalize first letter of the string).
|
|
1025
2021
|
|
|
1026
2022
|
#### Parameters
|
|
1027
2023
|
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
2024
|
+
<table>
|
|
2025
|
+
<thead>
|
|
2026
|
+
<tr>
|
|
2027
|
+
<th>Parameter</th>
|
|
2028
|
+
<th>Type</th>
|
|
2029
|
+
<th>Description</th>
|
|
2030
|
+
</tr>
|
|
2031
|
+
</thead>
|
|
2032
|
+
<tbody>
|
|
2033
|
+
<tr>
|
|
2034
|
+
<td>
|
|
2035
|
+
|
|
2036
|
+
`str?`
|
|
2037
|
+
|
|
2038
|
+
</td>
|
|
2039
|
+
<td>
|
|
2040
|
+
|
|
2041
|
+
`string`
|
|
2042
|
+
|
|
2043
|
+
</td>
|
|
2044
|
+
<td>
|
|
2045
|
+
|
|
2046
|
+
Optional string to join the words with.
|
|
2047
|
+
|
|
2048
|
+
</td>
|
|
2049
|
+
</tr>
|
|
2050
|
+
</tbody>
|
|
2051
|
+
</table>
|
|
1031
2052
|
|
|
1032
2053
|
#### Returns
|
|
1033
2054
|
|
|
@@ -1041,26 +2062,116 @@ String in first case.
|
|
|
1041
2062
|
toFirstCase("hello world"); // "Hello world"
|
|
1042
2063
|
```
|
|
1043
2064
|
|
|
1044
|
-
|
|
2065
|
+
---
|
|
2066
|
+
|
|
2067
|
+
### toFirstCaseBreak()
|
|
2068
|
+
|
|
2069
|
+
```ts
|
|
2070
|
+
function toFirstCaseBreak(str?, join?): string;
|
|
2071
|
+
```
|
|
2072
|
+
|
|
2073
|
+
Defined in: [string.utils.ts:159](https://github.com/hichchidev/hichchi/blob/06777a67b73a055af108a17d7e01cf94eabb6608/libs/utils/src/lib/string.utils.ts#L159)
|
|
2074
|
+
|
|
2075
|
+
#### Parameters
|
|
2076
|
+
|
|
2077
|
+
<table>
|
|
2078
|
+
<thead>
|
|
2079
|
+
<tr>
|
|
2080
|
+
<th>Parameter</th>
|
|
2081
|
+
<th>Type</th>
|
|
2082
|
+
</tr>
|
|
2083
|
+
</thead>
|
|
2084
|
+
<tbody>
|
|
2085
|
+
<tr>
|
|
2086
|
+
<td>
|
|
2087
|
+
|
|
2088
|
+
`str?`
|
|
2089
|
+
|
|
2090
|
+
</td>
|
|
2091
|
+
<td>
|
|
2092
|
+
|
|
2093
|
+
`string`
|
|
2094
|
+
|
|
2095
|
+
</td>
|
|
2096
|
+
</tr>
|
|
2097
|
+
<tr>
|
|
2098
|
+
<td>
|
|
2099
|
+
|
|
2100
|
+
`join?`
|
|
2101
|
+
|
|
2102
|
+
</td>
|
|
2103
|
+
<td>
|
|
2104
|
+
|
|
2105
|
+
`string`
|
|
2106
|
+
|
|
2107
|
+
</td>
|
|
2108
|
+
</tr>
|
|
2109
|
+
</tbody>
|
|
2110
|
+
</table>
|
|
1045
2111
|
|
|
1046
|
-
|
|
2112
|
+
#### Returns
|
|
2113
|
+
|
|
2114
|
+
`string`
|
|
1047
2115
|
|
|
1048
2116
|
---
|
|
1049
2117
|
|
|
1050
2118
|
### toKebabCase()
|
|
1051
2119
|
|
|
1052
2120
|
```ts
|
|
1053
|
-
function toKebabCase(str
|
|
2121
|
+
function toKebabCase(str?, caps?): string;
|
|
1054
2122
|
```
|
|
1055
2123
|
|
|
2124
|
+
Defined in: [string.utils.ts:282](https://github.com/hichchidev/hichchi/blob/06777a67b73a055af108a17d7e01cf94eabb6608/libs/utils/src/lib/string.utils.ts#L282)
|
|
2125
|
+
|
|
1056
2126
|
Convert a string to kebab case.
|
|
1057
2127
|
|
|
1058
2128
|
#### Parameters
|
|
1059
2129
|
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
2130
|
+
<table>
|
|
2131
|
+
<thead>
|
|
2132
|
+
<tr>
|
|
2133
|
+
<th>Parameter</th>
|
|
2134
|
+
<th>Type</th>
|
|
2135
|
+
<th>Description</th>
|
|
2136
|
+
</tr>
|
|
2137
|
+
</thead>
|
|
2138
|
+
<tbody>
|
|
2139
|
+
<tr>
|
|
2140
|
+
<td>
|
|
2141
|
+
|
|
2142
|
+
`str?`
|
|
2143
|
+
|
|
2144
|
+
</td>
|
|
2145
|
+
<td>
|
|
2146
|
+
|
|
2147
|
+
`string`
|
|
2148
|
+
|
|
2149
|
+
</td>
|
|
2150
|
+
<td>
|
|
2151
|
+
|
|
2152
|
+
String to convert to kebab case.
|
|
2153
|
+
|
|
2154
|
+
</td>
|
|
2155
|
+
</tr>
|
|
2156
|
+
<tr>
|
|
2157
|
+
<td>
|
|
2158
|
+
|
|
2159
|
+
`caps?`
|
|
2160
|
+
|
|
2161
|
+
</td>
|
|
2162
|
+
<td>
|
|
2163
|
+
|
|
2164
|
+
`boolean`
|
|
2165
|
+
|
|
2166
|
+
</td>
|
|
2167
|
+
<td>
|
|
2168
|
+
|
|
2169
|
+
Whether to convert to upper case.
|
|
2170
|
+
|
|
2171
|
+
</td>
|
|
2172
|
+
</tr>
|
|
2173
|
+
</tbody>
|
|
2174
|
+
</table>
|
|
1064
2175
|
|
|
1065
2176
|
#### Returns
|
|
1066
2177
|
|
|
@@ -1078,25 +2189,48 @@ toKebabCase("hello world"); // "hello-world"
|
|
|
1078
2189
|
toKebabCase("hello world", true); // "HELLO-WORLD"
|
|
1079
2190
|
```
|
|
1080
2191
|
|
|
1081
|
-
#### Defined in
|
|
1082
|
-
|
|
1083
|
-
string.utils.ts:273
|
|
1084
|
-
|
|
1085
2192
|
---
|
|
1086
2193
|
|
|
1087
2194
|
### toLowerCase()
|
|
1088
2195
|
|
|
1089
2196
|
```ts
|
|
1090
|
-
function toLowerCase(str
|
|
2197
|
+
function toLowerCase(str?): string;
|
|
1091
2198
|
```
|
|
1092
2199
|
|
|
2200
|
+
Defined in: [string.utils.ts:74](https://github.com/hichchidev/hichchi/blob/06777a67b73a055af108a17d7e01cf94eabb6608/libs/utils/src/lib/string.utils.ts#L74)
|
|
2201
|
+
|
|
1093
2202
|
Convert a string to lower case.
|
|
1094
2203
|
|
|
1095
2204
|
#### Parameters
|
|
1096
2205
|
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
2206
|
+
<table>
|
|
2207
|
+
<thead>
|
|
2208
|
+
<tr>
|
|
2209
|
+
<th>Parameter</th>
|
|
2210
|
+
<th>Type</th>
|
|
2211
|
+
<th>Description</th>
|
|
2212
|
+
</tr>
|
|
2213
|
+
</thead>
|
|
2214
|
+
<tbody>
|
|
2215
|
+
<tr>
|
|
2216
|
+
<td>
|
|
2217
|
+
|
|
2218
|
+
`str?`
|
|
2219
|
+
|
|
2220
|
+
</td>
|
|
2221
|
+
<td>
|
|
2222
|
+
|
|
2223
|
+
`string`
|
|
2224
|
+
|
|
2225
|
+
</td>
|
|
2226
|
+
<td>
|
|
2227
|
+
|
|
2228
|
+
String to convert to lower case.
|
|
2229
|
+
|
|
2230
|
+
</td>
|
|
2231
|
+
</tr>
|
|
2232
|
+
</tbody>
|
|
2233
|
+
</table>
|
|
1100
2234
|
|
|
1101
2235
|
#### Returns
|
|
1102
2236
|
|
|
@@ -1110,26 +2244,65 @@ String in lower case.
|
|
|
1110
2244
|
toLowerCase("Hello World"); // "hello world"
|
|
1111
2245
|
```
|
|
1112
2246
|
|
|
1113
|
-
#### Defined in
|
|
1114
|
-
|
|
1115
|
-
string.utils.ts:74
|
|
1116
|
-
|
|
1117
2247
|
---
|
|
1118
2248
|
|
|
1119
2249
|
### toLowerCaseBreak()
|
|
1120
2250
|
|
|
1121
2251
|
```ts
|
|
1122
|
-
function toLowerCaseBreak(str
|
|
2252
|
+
function toLowerCaseBreak(str?, join?): string;
|
|
1123
2253
|
```
|
|
1124
2254
|
|
|
2255
|
+
Defined in: [string.utils.ts:92](https://github.com/hichchidev/hichchi/blob/06777a67b73a055af108a17d7e01cf94eabb6608/libs/utils/src/lib/string.utils.ts#L92)
|
|
2256
|
+
|
|
1125
2257
|
Convert a string to lower cases and break into words with optional join or space.
|
|
1126
2258
|
|
|
1127
2259
|
#### Parameters
|
|
1128
2260
|
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
2261
|
+
<table>
|
|
2262
|
+
<thead>
|
|
2263
|
+
<tr>
|
|
2264
|
+
<th>Parameter</th>
|
|
2265
|
+
<th>Type</th>
|
|
2266
|
+
<th>Description</th>
|
|
2267
|
+
</tr>
|
|
2268
|
+
</thead>
|
|
2269
|
+
<tbody>
|
|
2270
|
+
<tr>
|
|
2271
|
+
<td>
|
|
2272
|
+
|
|
2273
|
+
`str?`
|
|
2274
|
+
|
|
2275
|
+
</td>
|
|
2276
|
+
<td>
|
|
2277
|
+
|
|
2278
|
+
`string`
|
|
2279
|
+
|
|
2280
|
+
</td>
|
|
2281
|
+
<td>
|
|
2282
|
+
|
|
2283
|
+
String to convert to lower cases and break into words.
|
|
2284
|
+
|
|
2285
|
+
</td>
|
|
2286
|
+
</tr>
|
|
2287
|
+
<tr>
|
|
2288
|
+
<td>
|
|
2289
|
+
|
|
2290
|
+
`join?`
|
|
2291
|
+
|
|
2292
|
+
</td>
|
|
2293
|
+
<td>
|
|
2294
|
+
|
|
2295
|
+
`string`
|
|
2296
|
+
|
|
2297
|
+
</td>
|
|
2298
|
+
<td>
|
|
2299
|
+
|
|
2300
|
+
Optional string to join the words with.
|
|
2301
|
+
|
|
2302
|
+
</td>
|
|
2303
|
+
</tr>
|
|
2304
|
+
</tbody>
|
|
2305
|
+
</table>
|
|
1133
2306
|
|
|
1134
2307
|
#### Returns
|
|
1135
2308
|
|
|
@@ -1143,29 +2316,52 @@ String in lower cases and broken into words.
|
|
|
1143
2316
|
toLowerCaseBreak("HelloWorld"); // "hello world"
|
|
1144
2317
|
```
|
|
1145
2318
|
|
|
1146
|
-
#### Defined in
|
|
1147
|
-
|
|
1148
|
-
string.utils.ts:92
|
|
1149
|
-
|
|
1150
2319
|
---
|
|
1151
2320
|
|
|
1152
2321
|
### toNumber()
|
|
1153
2322
|
|
|
1154
2323
|
```ts
|
|
1155
|
-
function toNumber(str:
|
|
2324
|
+
function toNumber(str): undefined | number;
|
|
1156
2325
|
```
|
|
1157
2326
|
|
|
2327
|
+
Defined in: [string.utils.ts:300](https://github.com/hichchidev/hichchi/blob/06777a67b73a055af108a17d7e01cf94eabb6608/libs/utils/src/lib/string.utils.ts#L300)
|
|
2328
|
+
|
|
1158
2329
|
Converts a string to a number.
|
|
1159
2330
|
|
|
1160
2331
|
#### Parameters
|
|
1161
2332
|
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
2333
|
+
<table>
|
|
2334
|
+
<thead>
|
|
2335
|
+
<tr>
|
|
2336
|
+
<th>Parameter</th>
|
|
2337
|
+
<th>Type</th>
|
|
2338
|
+
<th>Description</th>
|
|
2339
|
+
</tr>
|
|
2340
|
+
</thead>
|
|
2341
|
+
<tbody>
|
|
2342
|
+
<tr>
|
|
2343
|
+
<td>
|
|
2344
|
+
|
|
2345
|
+
`str`
|
|
2346
|
+
|
|
2347
|
+
</td>
|
|
2348
|
+
<td>
|
|
2349
|
+
|
|
2350
|
+
`string` \| `number`
|
|
2351
|
+
|
|
2352
|
+
</td>
|
|
2353
|
+
<td>
|
|
2354
|
+
|
|
2355
|
+
String to convert to a number.
|
|
2356
|
+
|
|
2357
|
+
</td>
|
|
2358
|
+
</tr>
|
|
2359
|
+
</tbody>
|
|
2360
|
+
</table>
|
|
1165
2361
|
|
|
1166
2362
|
#### Returns
|
|
1167
2363
|
|
|
1168
|
-
`
|
|
2364
|
+
`undefined` \| `number`
|
|
1169
2365
|
|
|
1170
2366
|
Number or undefined.
|
|
1171
2367
|
|
|
@@ -1175,25 +2371,48 @@ Number or undefined.
|
|
|
1175
2371
|
toNumber("123"); // 123
|
|
1176
2372
|
```
|
|
1177
2373
|
|
|
1178
|
-
#### Defined in
|
|
1179
|
-
|
|
1180
|
-
string.utils.ts:291
|
|
1181
|
-
|
|
1182
2374
|
---
|
|
1183
2375
|
|
|
1184
2376
|
### toPascalCase()
|
|
1185
2377
|
|
|
1186
2378
|
```ts
|
|
1187
|
-
function toPascalCase(str
|
|
2379
|
+
function toPascalCase(str?): string;
|
|
1188
2380
|
```
|
|
1189
2381
|
|
|
2382
|
+
Defined in: [string.utils.ts:216](https://github.com/hichchidev/hichchi/blob/06777a67b73a055af108a17d7e01cf94eabb6608/libs/utils/src/lib/string.utils.ts#L216)
|
|
2383
|
+
|
|
1190
2384
|
Convert a string to pascal case.
|
|
1191
2385
|
|
|
1192
2386
|
#### Parameters
|
|
1193
2387
|
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
2388
|
+
<table>
|
|
2389
|
+
<thead>
|
|
2390
|
+
<tr>
|
|
2391
|
+
<th>Parameter</th>
|
|
2392
|
+
<th>Type</th>
|
|
2393
|
+
<th>Description</th>
|
|
2394
|
+
</tr>
|
|
2395
|
+
</thead>
|
|
2396
|
+
<tbody>
|
|
2397
|
+
<tr>
|
|
2398
|
+
<td>
|
|
2399
|
+
|
|
2400
|
+
`str?`
|
|
2401
|
+
|
|
2402
|
+
</td>
|
|
2403
|
+
<td>
|
|
2404
|
+
|
|
2405
|
+
`string`
|
|
2406
|
+
|
|
2407
|
+
</td>
|
|
2408
|
+
<td>
|
|
2409
|
+
|
|
2410
|
+
String to convert to pascal case.
|
|
2411
|
+
|
|
2412
|
+
</td>
|
|
2413
|
+
</tr>
|
|
2414
|
+
</tbody>
|
|
2415
|
+
</table>
|
|
1197
2416
|
|
|
1198
2417
|
#### Returns
|
|
1199
2418
|
|
|
@@ -1207,25 +2426,48 @@ String in pascal case.
|
|
|
1207
2426
|
toPascalCase("hello world"); // "HelloWorld"
|
|
1208
2427
|
```
|
|
1209
2428
|
|
|
1210
|
-
#### Defined in
|
|
1211
|
-
|
|
1212
|
-
string.utils.ts:207
|
|
1213
|
-
|
|
1214
2429
|
---
|
|
1215
2430
|
|
|
1216
2431
|
### toSentenceCase()
|
|
1217
2432
|
|
|
1218
2433
|
```ts
|
|
1219
|
-
function toSentenceCase(str
|
|
2434
|
+
function toSentenceCase(str?): string;
|
|
1220
2435
|
```
|
|
1221
2436
|
|
|
2437
|
+
Defined in: [string.utils.ts:235](https://github.com/hichchidev/hichchi/blob/06777a67b73a055af108a17d7e01cf94eabb6608/libs/utils/src/lib/string.utils.ts#L235)
|
|
2438
|
+
|
|
1222
2439
|
Convert a string to sentence case. (Capitalize first letter of every sentence).
|
|
1223
2440
|
|
|
1224
2441
|
#### Parameters
|
|
1225
2442
|
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
2443
|
+
<table>
|
|
2444
|
+
<thead>
|
|
2445
|
+
<tr>
|
|
2446
|
+
<th>Parameter</th>
|
|
2447
|
+
<th>Type</th>
|
|
2448
|
+
<th>Description</th>
|
|
2449
|
+
</tr>
|
|
2450
|
+
</thead>
|
|
2451
|
+
<tbody>
|
|
2452
|
+
<tr>
|
|
2453
|
+
<td>
|
|
2454
|
+
|
|
2455
|
+
`str?`
|
|
2456
|
+
|
|
2457
|
+
</td>
|
|
2458
|
+
<td>
|
|
2459
|
+
|
|
2460
|
+
`string`
|
|
2461
|
+
|
|
2462
|
+
</td>
|
|
2463
|
+
<td>
|
|
2464
|
+
|
|
2465
|
+
String to convert to sentence case.
|
|
2466
|
+
|
|
2467
|
+
</td>
|
|
2468
|
+
</tr>
|
|
2469
|
+
</tbody>
|
|
2470
|
+
</table>
|
|
1229
2471
|
|
|
1230
2472
|
#### Returns
|
|
1231
2473
|
|
|
@@ -1239,26 +2481,65 @@ String in sentence case.
|
|
|
1239
2481
|
toSentenceCase("hello world. how are you?"); // "Hello world. How are you?"
|
|
1240
2482
|
```
|
|
1241
2483
|
|
|
1242
|
-
#### Defined in
|
|
1243
|
-
|
|
1244
|
-
string.utils.ts:226
|
|
1245
|
-
|
|
1246
2484
|
---
|
|
1247
2485
|
|
|
1248
2486
|
### toSnakeCase()
|
|
1249
2487
|
|
|
1250
2488
|
```ts
|
|
1251
|
-
function toSnakeCase(str
|
|
2489
|
+
function toSnakeCase(str?, caps?): string;
|
|
1252
2490
|
```
|
|
1253
2491
|
|
|
2492
|
+
Defined in: [string.utils.ts:258](https://github.com/hichchidev/hichchi/blob/06777a67b73a055af108a17d7e01cf94eabb6608/libs/utils/src/lib/string.utils.ts#L258)
|
|
2493
|
+
|
|
1254
2494
|
Convert a string to snake case.
|
|
1255
2495
|
|
|
1256
2496
|
#### Parameters
|
|
1257
2497
|
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
2498
|
+
<table>
|
|
2499
|
+
<thead>
|
|
2500
|
+
<tr>
|
|
2501
|
+
<th>Parameter</th>
|
|
2502
|
+
<th>Type</th>
|
|
2503
|
+
<th>Description</th>
|
|
2504
|
+
</tr>
|
|
2505
|
+
</thead>
|
|
2506
|
+
<tbody>
|
|
2507
|
+
<tr>
|
|
2508
|
+
<td>
|
|
2509
|
+
|
|
2510
|
+
`str?`
|
|
2511
|
+
|
|
2512
|
+
</td>
|
|
2513
|
+
<td>
|
|
2514
|
+
|
|
2515
|
+
`string`
|
|
2516
|
+
|
|
2517
|
+
</td>
|
|
2518
|
+
<td>
|
|
2519
|
+
|
|
2520
|
+
String to convert to snake case.
|
|
2521
|
+
|
|
2522
|
+
</td>
|
|
2523
|
+
</tr>
|
|
2524
|
+
<tr>
|
|
2525
|
+
<td>
|
|
2526
|
+
|
|
2527
|
+
`caps?`
|
|
2528
|
+
|
|
2529
|
+
</td>
|
|
2530
|
+
<td>
|
|
2531
|
+
|
|
2532
|
+
`boolean`
|
|
2533
|
+
|
|
2534
|
+
</td>
|
|
2535
|
+
<td>
|
|
2536
|
+
|
|
2537
|
+
Whether to convert to upper case.
|
|
2538
|
+
|
|
2539
|
+
</td>
|
|
2540
|
+
</tr>
|
|
2541
|
+
</tbody>
|
|
2542
|
+
</table>
|
|
1262
2543
|
|
|
1263
2544
|
#### Returns
|
|
1264
2545
|
|
|
@@ -1276,25 +2557,48 @@ toSnakeCase("hello world"); // "hello_world"
|
|
|
1276
2557
|
toSnakeCase("hello world", true); // "HELLO_WORLD"
|
|
1277
2558
|
```
|
|
1278
2559
|
|
|
1279
|
-
#### Defined in
|
|
1280
|
-
|
|
1281
|
-
string.utils.ts:249
|
|
1282
|
-
|
|
1283
2560
|
---
|
|
1284
2561
|
|
|
1285
2562
|
### toTitleCase()
|
|
1286
2563
|
|
|
1287
2564
|
```ts
|
|
1288
|
-
function toTitleCase(str
|
|
2565
|
+
function toTitleCase(str?): string;
|
|
1289
2566
|
```
|
|
1290
2567
|
|
|
2568
|
+
Defined in: [string.utils.ts:178](https://github.com/hichchidev/hichchi/blob/06777a67b73a055af108a17d7e01cf94eabb6608/libs/utils/src/lib/string.utils.ts#L178)
|
|
2569
|
+
|
|
1291
2570
|
Convert a string to title case (Capitalize first letter of each word).
|
|
1292
2571
|
|
|
1293
2572
|
#### Parameters
|
|
1294
2573
|
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
2574
|
+
<table>
|
|
2575
|
+
<thead>
|
|
2576
|
+
<tr>
|
|
2577
|
+
<th>Parameter</th>
|
|
2578
|
+
<th>Type</th>
|
|
2579
|
+
<th>Description</th>
|
|
2580
|
+
</tr>
|
|
2581
|
+
</thead>
|
|
2582
|
+
<tbody>
|
|
2583
|
+
<tr>
|
|
2584
|
+
<td>
|
|
2585
|
+
|
|
2586
|
+
`str?`
|
|
2587
|
+
|
|
2588
|
+
</td>
|
|
2589
|
+
<td>
|
|
2590
|
+
|
|
2591
|
+
`string`
|
|
2592
|
+
|
|
2593
|
+
</td>
|
|
2594
|
+
<td>
|
|
2595
|
+
|
|
2596
|
+
String to convert to title case.
|
|
2597
|
+
|
|
2598
|
+
</td>
|
|
2599
|
+
</tr>
|
|
2600
|
+
</tbody>
|
|
2601
|
+
</table>
|
|
1298
2602
|
|
|
1299
2603
|
#### Returns
|
|
1300
2604
|
|
|
@@ -1308,25 +2612,48 @@ String in title case.
|
|
|
1308
2612
|
toTitleCase("hello world"); // "Hello World"
|
|
1309
2613
|
```
|
|
1310
2614
|
|
|
1311
|
-
#### Defined in
|
|
1312
|
-
|
|
1313
|
-
string.utils.ts:169
|
|
1314
|
-
|
|
1315
2615
|
---
|
|
1316
2616
|
|
|
1317
2617
|
### toUpperCase()
|
|
1318
2618
|
|
|
1319
2619
|
```ts
|
|
1320
|
-
function toUpperCase(str
|
|
2620
|
+
function toUpperCase(str?): string;
|
|
1321
2621
|
```
|
|
1322
2622
|
|
|
2623
|
+
Defined in: [string.utils.ts:111](https://github.com/hichchidev/hichchi/blob/06777a67b73a055af108a17d7e01cf94eabb6608/libs/utils/src/lib/string.utils.ts#L111)
|
|
2624
|
+
|
|
1323
2625
|
Convert a string to upper case.
|
|
1324
2626
|
|
|
1325
2627
|
#### Parameters
|
|
1326
2628
|
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
2629
|
+
<table>
|
|
2630
|
+
<thead>
|
|
2631
|
+
<tr>
|
|
2632
|
+
<th>Parameter</th>
|
|
2633
|
+
<th>Type</th>
|
|
2634
|
+
<th>Description</th>
|
|
2635
|
+
</tr>
|
|
2636
|
+
</thead>
|
|
2637
|
+
<tbody>
|
|
2638
|
+
<tr>
|
|
2639
|
+
<td>
|
|
2640
|
+
|
|
2641
|
+
`str?`
|
|
2642
|
+
|
|
2643
|
+
</td>
|
|
2644
|
+
<td>
|
|
2645
|
+
|
|
2646
|
+
`string`
|
|
2647
|
+
|
|
2648
|
+
</td>
|
|
2649
|
+
<td>
|
|
2650
|
+
|
|
2651
|
+
String to convert to upper case.
|
|
2652
|
+
|
|
2653
|
+
</td>
|
|
2654
|
+
</tr>
|
|
2655
|
+
</tbody>
|
|
2656
|
+
</table>
|
|
1330
2657
|
|
|
1331
2658
|
#### Returns
|
|
1332
2659
|
|
|
@@ -1340,26 +2667,65 @@ String in upper case.
|
|
|
1340
2667
|
toUpperCase("HelloWorld"); // "HELLO WORLD"
|
|
1341
2668
|
```
|
|
1342
2669
|
|
|
1343
|
-
#### Defined in
|
|
1344
|
-
|
|
1345
|
-
string.utils.ts:111
|
|
1346
|
-
|
|
1347
2670
|
---
|
|
1348
2671
|
|
|
1349
2672
|
### toUpperCaseBreak()
|
|
1350
2673
|
|
|
1351
2674
|
```ts
|
|
1352
|
-
function toUpperCaseBreak(str
|
|
2675
|
+
function toUpperCaseBreak(str?, join?): string;
|
|
1353
2676
|
```
|
|
1354
2677
|
|
|
2678
|
+
Defined in: [string.utils.ts:133](https://github.com/hichchidev/hichchi/blob/06777a67b73a055af108a17d7e01cf94eabb6608/libs/utils/src/lib/string.utils.ts#L133)
|
|
2679
|
+
|
|
1355
2680
|
Convert a string to upper cases and break into words with optional join or space.
|
|
1356
2681
|
|
|
1357
2682
|
#### Parameters
|
|
1358
2683
|
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
2684
|
+
<table>
|
|
2685
|
+
<thead>
|
|
2686
|
+
<tr>
|
|
2687
|
+
<th>Parameter</th>
|
|
2688
|
+
<th>Type</th>
|
|
2689
|
+
<th>Description</th>
|
|
2690
|
+
</tr>
|
|
2691
|
+
</thead>
|
|
2692
|
+
<tbody>
|
|
2693
|
+
<tr>
|
|
2694
|
+
<td>
|
|
2695
|
+
|
|
2696
|
+
`str?`
|
|
2697
|
+
|
|
2698
|
+
</td>
|
|
2699
|
+
<td>
|
|
2700
|
+
|
|
2701
|
+
`string`
|
|
2702
|
+
|
|
2703
|
+
</td>
|
|
2704
|
+
<td>
|
|
2705
|
+
|
|
2706
|
+
String to convert to upper cases and break into words.
|
|
2707
|
+
|
|
2708
|
+
</td>
|
|
2709
|
+
</tr>
|
|
2710
|
+
<tr>
|
|
2711
|
+
<td>
|
|
2712
|
+
|
|
2713
|
+
`join?`
|
|
2714
|
+
|
|
2715
|
+
</td>
|
|
2716
|
+
<td>
|
|
2717
|
+
|
|
2718
|
+
`string`
|
|
2719
|
+
|
|
2720
|
+
</td>
|
|
2721
|
+
<td>
|
|
2722
|
+
|
|
2723
|
+
Optional string to join the words with.
|
|
2724
|
+
|
|
2725
|
+
</td>
|
|
2726
|
+
</tr>
|
|
2727
|
+
</tbody>
|
|
2728
|
+
</table>
|
|
1363
2729
|
|
|
1364
2730
|
#### Returns
|
|
1365
2731
|
|
|
@@ -1375,8 +2741,4 @@ toUpperCaseBreak("HelloWorld"); // "HELLO WORLD"
|
|
|
1375
2741
|
|
|
1376
2742
|
```TypeScript
|
|
1377
2743
|
toUpperCaseBreak("HelloWorld", "! "); // "HELLO! WORLD"
|
|
1378
|
-
|
|
1379
|
-
#### Defined in
|
|
1380
|
-
|
|
1381
|
-
string.utils.ts:133
|
|
1382
2744
|
```
|