@akadenia/helpers 1.7.2 → 1.7.3
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/README.MD +11 -5
- package/dist/text.js +1 -1
- package/package.json +1 -1
package/README.MD
CHANGED
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
- [Contributing to this package](#contributing-to-this-package)
|
|
51
51
|
- [License](#license)
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
## DateHelpers
|
|
54
54
|
|
|
55
55
|
Import the DateHelpers utility.
|
|
56
56
|
|
|
@@ -137,7 +137,7 @@ Arguments
|
|
|
137
137
|
|--|--|--|--|
|
|
138
138
|
|`coordinates`|`object`|`true`|An object containing the start and end coordinates. i.e. `{startCoordinate: [lat, lng], endCoordinate: [lat, lng]}`|
|
|
139
139
|
|
|
140
|
-
|
|
140
|
+
## TextHelpers
|
|
141
141
|
|
|
142
142
|
Import the TextHelpers utility.
|
|
143
143
|
|
|
@@ -355,6 +355,7 @@ Arguments
|
|
|
355
355
|
|`number`|`number`|`true`|The number to be abbreviated|
|
|
356
356
|
|
|
357
357
|
Examples
|
|
358
|
+
|
|
358
359
|
- Numbers below 1,000 are displayed without abbreviation
|
|
359
360
|
- Numbers between 1,000 and 1,000,000 are displayed in thousands (e.g. 1.23K)
|
|
360
361
|
- Numbers between 1,000,000 and 1,000,000,000 are displayed in millions (e.g. 1.23M)
|
|
@@ -362,7 +363,7 @@ Examples
|
|
|
362
363
|
|
|
363
364
|
Note: If the input `number` is null or undefined, the function returns null.
|
|
364
365
|
|
|
365
|
-
|
|
366
|
+
## ObjectHelpers
|
|
366
367
|
|
|
367
368
|
Import the ObjectHelpers utility.
|
|
368
369
|
|
|
@@ -392,9 +393,11 @@ Filter an array of objects based on a specific property and its corresponding va
|
|
|
392
393
|
Returns an array containing all objects that have the specified property with the given value.
|
|
393
394
|
|
|
394
395
|
Template
|
|
396
|
+
|
|
395
397
|
```typescript
|
|
396
398
|
T extends Record<string, any>
|
|
397
399
|
```
|
|
400
|
+
|
|
398
401
|
Arguments
|
|
399
402
|
|Name|Type|Required|Description|
|
|
400
403
|
|--|--|--|--|
|
|
@@ -408,6 +411,7 @@ It compares the key-value pairs of the sub-object with the corresponding key-val
|
|
|
408
411
|
Returns true If all key-value pairs in the sub-object are found in the main object; otherwise, it returns false.
|
|
409
412
|
|
|
410
413
|
Template
|
|
414
|
+
|
|
411
415
|
```typescript
|
|
412
416
|
T extends Record<string, any>
|
|
413
417
|
```
|
|
@@ -425,6 +429,7 @@ Returns the first object found in the array that contains the sub-object or null
|
|
|
425
429
|
if no match is found.
|
|
426
430
|
|
|
427
431
|
Template
|
|
432
|
+
|
|
428
433
|
```typescript
|
|
429
434
|
T extends Record<string, any>
|
|
430
435
|
```
|
|
@@ -441,6 +446,7 @@ Filters an array of objects based on the presence of a specific sub-object withi
|
|
|
441
446
|
Returns an array containing all objects from the input array that contain the specified sub-object.
|
|
442
447
|
|
|
443
448
|
Template
|
|
449
|
+
|
|
444
450
|
```typescript
|
|
445
451
|
T extends Record<string, any>
|
|
446
452
|
```
|
|
@@ -472,7 +478,7 @@ Arguments
|
|
|
472
478
|
|`array`|`Array<any>`|`true`|The array of entries to search|
|
|
473
479
|
|`predicate`|`(item: any) => boolean`|`true`|The predicate function to use to search the array|
|
|
474
480
|
|
|
475
|
-
|
|
481
|
+
## GenericHelpers
|
|
476
482
|
|
|
477
483
|
Import the GenericHelpers utility.
|
|
478
484
|
|
|
@@ -496,7 +502,7 @@ Arguments
|
|
|
496
502
|
|--|--|--|--|
|
|
497
503
|
|`host`|`string`|`true`|An IP address or a domain name|
|
|
498
504
|
|
|
499
|
-
|
|
505
|
+
## FileHelpers
|
|
500
506
|
|
|
501
507
|
## `FileHelpers.checkFileExtension(filePath, validExtensions)`
|
|
502
508
|
|
package/dist/text.js
CHANGED
|
@@ -327,7 +327,7 @@ const abbreviateNumber = (number) => {
|
|
|
327
327
|
{ value: 1e6, symbol: "M" },
|
|
328
328
|
{ value: 1e3, symbol: "K" },
|
|
329
329
|
];
|
|
330
|
-
if (
|
|
330
|
+
if (number === null || number === undefined || isNaN(number))
|
|
331
331
|
return null;
|
|
332
332
|
const abbreviated = abbreviations.find(({ value }) => Math.abs(number) >= value);
|
|
333
333
|
if (abbreviated) {
|