@react-hive/honey-utils 2.4.0 → 3.1.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.
- package/README.md +213 -105
- package/dist/README.md +213 -105
- package/dist/array.d.ts +16 -0
- package/dist/async.d.ts +10 -0
- package/dist/dom.d.ts +0 -20
- package/dist/file.d.ts +99 -0
- package/dist/function.d.ts +8 -0
- package/dist/guards.d.ts +0 -55
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.dev.cjs +247 -91
- package/dist/index.dev.cjs.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/string.d.ts +21 -0
- package/package.json +1 -1
package/dist/index.dev.cjs
CHANGED
|
@@ -15,11 +15,29 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
15
15
|
/* harmony export */ compose: () => (/* binding */ compose),
|
|
16
16
|
/* harmony export */ difference: () => (/* binding */ difference),
|
|
17
17
|
/* harmony export */ intersection: () => (/* binding */ intersection),
|
|
18
|
+
/* harmony export */ isArray: () => (/* binding */ isArray),
|
|
19
|
+
/* harmony export */ isEmptyArray: () => (/* binding */ isEmptyArray),
|
|
18
20
|
/* harmony export */ pipe: () => (/* binding */ pipe),
|
|
19
21
|
/* harmony export */ unique: () => (/* binding */ unique)
|
|
20
22
|
/* harmony export */ });
|
|
21
23
|
/* harmony import */ var _guards__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./guards */ "./src/guards.ts");
|
|
22
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Checks if a value is an array.
|
|
27
|
+
*
|
|
28
|
+
* @param value - The value to check.
|
|
29
|
+
*
|
|
30
|
+
* @returns `true` if the value is an array; otherwise, `false`.
|
|
31
|
+
*/
|
|
32
|
+
const isArray = (value) => Array.isArray(value);
|
|
33
|
+
/**
|
|
34
|
+
* Checks if a value is an empty array.
|
|
35
|
+
*
|
|
36
|
+
* @param value - The value to check.
|
|
37
|
+
*
|
|
38
|
+
* @returns `true` if the value is an empty array; otherwise, `false`.
|
|
39
|
+
*/
|
|
40
|
+
const isEmptyArray = (value) => isArray(value) && value.length === 0;
|
|
23
41
|
/**
|
|
24
42
|
* Removes all falsy values from an array.
|
|
25
43
|
*
|
|
@@ -182,13 +200,26 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
182
200
|
/* harmony export */ filterParallel: () => (/* binding */ filterParallel),
|
|
183
201
|
/* harmony export */ filterSequential: () => (/* binding */ filterSequential),
|
|
184
202
|
/* harmony export */ findAsync: () => (/* binding */ findAsync),
|
|
203
|
+
/* harmony export */ isPromise: () => (/* binding */ isPromise),
|
|
185
204
|
/* harmony export */ reduceAsync: () => (/* binding */ reduceAsync),
|
|
186
205
|
/* harmony export */ runParallel: () => (/* binding */ runParallel),
|
|
187
206
|
/* harmony export */ runSequential: () => (/* binding */ runSequential),
|
|
188
207
|
/* harmony export */ someAsync: () => (/* binding */ someAsync)
|
|
189
208
|
/* harmony export */ });
|
|
190
209
|
/* harmony import */ var _array__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./array */ "./src/array.ts");
|
|
210
|
+
/* harmony import */ var _function__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./function */ "./src/function.ts");
|
|
211
|
+
|
|
191
212
|
|
|
213
|
+
/**
|
|
214
|
+
* Checks if a value is a Promise.
|
|
215
|
+
*
|
|
216
|
+
* @template T - The type of the value that the Promise resolves to.
|
|
217
|
+
*
|
|
218
|
+
* @param value - The value to check.
|
|
219
|
+
*
|
|
220
|
+
* @returns `true` if the value is a Promise; otherwise, `false`.
|
|
221
|
+
*/
|
|
222
|
+
const isPromise = (value) => (0,_function__WEBPACK_IMPORTED_MODULE_1__.isFunction)(value?.then);
|
|
192
223
|
/**
|
|
193
224
|
* Asynchronously iterates over an array and executes an async function on each item sequentially,
|
|
194
225
|
* collecting the results.
|
|
@@ -385,7 +416,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
385
416
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
386
417
|
/* harmony export */ FOCUSABLE_HTML_TAGS: () => (/* binding */ FOCUSABLE_HTML_TAGS),
|
|
387
418
|
/* harmony export */ cloneBlob: () => (/* binding */ cloneBlob),
|
|
388
|
-
/* harmony export */ convertBlobToFile: () => (/* binding */ convertBlobToFile),
|
|
389
419
|
/* harmony export */ getDOMRectIntersectionRatio: () => (/* binding */ getDOMRectIntersectionRatio),
|
|
390
420
|
/* harmony export */ getElementOffsetRect: () => (/* binding */ getElementOffsetRect),
|
|
391
421
|
/* harmony export */ getFocusableHtmlElements: () => (/* binding */ getFocusableHtmlElements),
|
|
@@ -444,28 +474,6 @@ const parse2DMatrix = (element) => {
|
|
|
444
474
|
* @returns A new Blob with the same content and type as the original.
|
|
445
475
|
*/
|
|
446
476
|
const cloneBlob = (blob) => new Blob([blob], { type: blob.type });
|
|
447
|
-
/**
|
|
448
|
-
* Converts a `Blob` object into a `File` object with the specified name.
|
|
449
|
-
*
|
|
450
|
-
* This is useful when you receive a `Blob` (e.g., from canvas, fetch, or file manipulation)
|
|
451
|
-
* and need to convert it into a `File` to upload via `FormData` or file inputs.
|
|
452
|
-
*
|
|
453
|
-
* @param blob - The `Blob` to convert.
|
|
454
|
-
* @param fileName - The desired name for the resulting file (including extension).
|
|
455
|
-
*
|
|
456
|
-
* @returns A `File` instance with the same content and MIME type as the input `Blob`.
|
|
457
|
-
*
|
|
458
|
-
* @example
|
|
459
|
-
* ```ts
|
|
460
|
-
* const blob = new Blob(['Hello world'], { type: 'text/plain' });
|
|
461
|
-
* const file = convertBlobToFile(blob, 'hello.txt');
|
|
462
|
-
*
|
|
463
|
-
* console.log(file instanceof File); // true
|
|
464
|
-
* ```
|
|
465
|
-
*/
|
|
466
|
-
const convertBlobToFile = (blob, fileName) => new File([blob], fileName, {
|
|
467
|
-
type: blob.type,
|
|
468
|
-
});
|
|
469
477
|
/**
|
|
470
478
|
* Calculates the intersection ratio between two DOM rectangles.
|
|
471
479
|
*
|
|
@@ -578,6 +586,175 @@ const isHtmlElementFocusable = (element) => {
|
|
|
578
586
|
const getFocusableHtmlElements = (container) => Array.from(container.querySelectorAll('*')).filter(isHtmlElementFocusable);
|
|
579
587
|
|
|
580
588
|
|
|
589
|
+
/***/ }),
|
|
590
|
+
|
|
591
|
+
/***/ "./src/file.ts":
|
|
592
|
+
/*!*********************!*\
|
|
593
|
+
!*** ./src/file.ts ***!
|
|
594
|
+
\*********************/
|
|
595
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
596
|
+
|
|
597
|
+
__webpack_require__.r(__webpack_exports__);
|
|
598
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
599
|
+
/* harmony export */ blobToFile: () => (/* binding */ blobToFile),
|
|
600
|
+
/* harmony export */ fileListToFiles: () => (/* binding */ fileListToFiles),
|
|
601
|
+
/* harmony export */ isFile: () => (/* binding */ isFile),
|
|
602
|
+
/* harmony export */ parseFileName: () => (/* binding */ parseFileName),
|
|
603
|
+
/* harmony export */ traverseFileSystemDirectory: () => (/* binding */ traverseFileSystemDirectory)
|
|
604
|
+
/* harmony export */ });
|
|
605
|
+
/* harmony import */ var _async__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./async */ "./src/async.ts");
|
|
606
|
+
|
|
607
|
+
/**
|
|
608
|
+
* Checks if a value is a `File` object.
|
|
609
|
+
*
|
|
610
|
+
* @param value - The value to check.
|
|
611
|
+
*
|
|
612
|
+
* @returns `true` if the value is a `File` object; otherwise, `false`.
|
|
613
|
+
*/
|
|
614
|
+
const isFile = (value) => value instanceof File;
|
|
615
|
+
/**
|
|
616
|
+
* Splits a file name into its base name and extension.
|
|
617
|
+
*
|
|
618
|
+
* Special cases:
|
|
619
|
+
* - Files without a dot return `[fileName, ""]`
|
|
620
|
+
* - Hidden files like `.gitignore` return `[".gitignore", ""]`
|
|
621
|
+
* - Names ending with a trailing dot (e.g., `"file."`) return `["file.", ""]`
|
|
622
|
+
* - Multi-dot names (e.g., `"archive.tar.gz"`) split on the last dot
|
|
623
|
+
*
|
|
624
|
+
* @param fileName - The full file name to parse.
|
|
625
|
+
*
|
|
626
|
+
* @returns A tuple where:
|
|
627
|
+
* - index 0 is the base name
|
|
628
|
+
* - index 1 is the file extension (lowercased), or an empty string if none exists
|
|
629
|
+
*/
|
|
630
|
+
const parseFileName = (fileName) => {
|
|
631
|
+
const lastDotIndex = fileName.lastIndexOf('.');
|
|
632
|
+
// No dot or leading dot with no extension (e.g., ".gitignore")
|
|
633
|
+
if (lastDotIndex <= 0 || lastDotIndex === fileName.length - 1) {
|
|
634
|
+
return [fileName, ''];
|
|
635
|
+
}
|
|
636
|
+
return [fileName.slice(0, lastDotIndex), fileName.slice(lastDotIndex + 1).toLowerCase()];
|
|
637
|
+
};
|
|
638
|
+
/**
|
|
639
|
+
* Converts a `FileList` object to an array of `File` objects.
|
|
640
|
+
*
|
|
641
|
+
* @param fileList - The `FileList` object to convert.
|
|
642
|
+
*
|
|
643
|
+
* @returns An array of `File` objects.
|
|
644
|
+
*/
|
|
645
|
+
const fileListToFiles = (fileList) => {
|
|
646
|
+
if (!fileList) {
|
|
647
|
+
return [];
|
|
648
|
+
}
|
|
649
|
+
const files = [];
|
|
650
|
+
for (let i = 0; i < fileList.length; i++) {
|
|
651
|
+
files.push(fileList[i]);
|
|
652
|
+
}
|
|
653
|
+
return files;
|
|
654
|
+
};
|
|
655
|
+
/**
|
|
656
|
+
* Converts a `Blob` object into a `File` object with the specified name.
|
|
657
|
+
*
|
|
658
|
+
* This is useful when you receive a `Blob` (e.g., from canvas, fetch, or file manipulation)
|
|
659
|
+
* and need to convert it into a `File` to upload via `FormData` or file inputs.
|
|
660
|
+
*
|
|
661
|
+
* @param blob - The `Blob` to convert.
|
|
662
|
+
* @param fileName - The desired name for the resulting file (including extension).
|
|
663
|
+
*
|
|
664
|
+
* @returns A `File` instance with the same content and MIME type as the input `Blob`.
|
|
665
|
+
*
|
|
666
|
+
* @example
|
|
667
|
+
* ```ts
|
|
668
|
+
* const blob = new Blob(['Hello world'], { type: 'text/plain' });
|
|
669
|
+
* const file = blobToFile(blob, 'hello.txt');
|
|
670
|
+
*
|
|
671
|
+
* console.log(file instanceof File); // true
|
|
672
|
+
* ```
|
|
673
|
+
*/
|
|
674
|
+
const blobToFile = (blob, fileName) => new File([blob], fileName, {
|
|
675
|
+
type: blob.type,
|
|
676
|
+
});
|
|
677
|
+
/**
|
|
678
|
+
* Reads all entries from a file system directory asynchronously.
|
|
679
|
+
*
|
|
680
|
+
* @param directoryEntry - The directory entry to read.
|
|
681
|
+
*
|
|
682
|
+
* @returns A promise that resolves to all `FileSystemEntry` items in the directory.
|
|
683
|
+
*/
|
|
684
|
+
const readFileSystemDirectoryEntries = async (directoryEntry) => {
|
|
685
|
+
const directoryReader = directoryEntry.createReader();
|
|
686
|
+
const readAll = async () => new Promise((resolve, reject) => {
|
|
687
|
+
directoryReader.readEntries(async (entries) => {
|
|
688
|
+
if (!entries.length) {
|
|
689
|
+
resolve([]);
|
|
690
|
+
return;
|
|
691
|
+
}
|
|
692
|
+
try {
|
|
693
|
+
const restEntries = await readAll();
|
|
694
|
+
resolve([...entries, ...restEntries]);
|
|
695
|
+
}
|
|
696
|
+
catch (e) {
|
|
697
|
+
reject(e);
|
|
698
|
+
}
|
|
699
|
+
}, reject);
|
|
700
|
+
});
|
|
701
|
+
return readAll();
|
|
702
|
+
};
|
|
703
|
+
/**
|
|
704
|
+
* Recursively scans a directory using the File System API and collects all nested files.
|
|
705
|
+
*
|
|
706
|
+
* This function walks through all subdirectories, resolving each file into a `File` object.
|
|
707
|
+
* Directories themselves are not returned. To avoid unnecessary noise, certain system or
|
|
708
|
+
* OS-generated files can be excluded via the `skipFiles` option.
|
|
709
|
+
*
|
|
710
|
+
* A progress callback (`onProgress`) may be provided to receive updates each time a file
|
|
711
|
+
* is discovered. This is useful when working with large folders or deeply nested structures.
|
|
712
|
+
*
|
|
713
|
+
* @param directoryEntry - The starting directory entry to traverse.
|
|
714
|
+
* @param options - Optional settings that control traversal behavior.
|
|
715
|
+
* @param processed - Internal counter used to track the number of processed files
|
|
716
|
+
* during recursive traversal. Not intended to be provided manually.
|
|
717
|
+
*
|
|
718
|
+
* @returns A promise resolving to a flat array of all collected `File` objects.
|
|
719
|
+
*/
|
|
720
|
+
const traverseFileSystemDirectory = async (directoryEntry, { skipFiles = [
|
|
721
|
+
'.DS_Store',
|
|
722
|
+
'Thumbs.db',
|
|
723
|
+
'desktop.ini',
|
|
724
|
+
'ehthumbs.db',
|
|
725
|
+
'.Spotlight-V100',
|
|
726
|
+
'.Trashes',
|
|
727
|
+
'.fseventsd',
|
|
728
|
+
'__MACOSX',
|
|
729
|
+
], onProgress, } = {}, processed = 0) => {
|
|
730
|
+
const skipSet = new Set(skipFiles);
|
|
731
|
+
const entries = await readFileSystemDirectoryEntries(directoryEntry);
|
|
732
|
+
const filePromises = await (0,_async__WEBPACK_IMPORTED_MODULE_0__.runParallel)(entries, async (entry) => {
|
|
733
|
+
if (entry.isDirectory) {
|
|
734
|
+
return traverseFileSystemDirectory(entry, {
|
|
735
|
+
skipFiles,
|
|
736
|
+
}, processed);
|
|
737
|
+
}
|
|
738
|
+
else if (!skipSet.has(entry.name)) {
|
|
739
|
+
const file = await new Promise((resolve, reject) => {
|
|
740
|
+
entry.file(resolve, reject);
|
|
741
|
+
});
|
|
742
|
+
if (onProgress) {
|
|
743
|
+
processed++;
|
|
744
|
+
onProgress({
|
|
745
|
+
processed,
|
|
746
|
+
path: `${directoryEntry.fullPath}/${entry.name}`,
|
|
747
|
+
currentFile: file,
|
|
748
|
+
});
|
|
749
|
+
}
|
|
750
|
+
return [file];
|
|
751
|
+
}
|
|
752
|
+
return [];
|
|
753
|
+
});
|
|
754
|
+
return filePromises.flat();
|
|
755
|
+
};
|
|
756
|
+
|
|
757
|
+
|
|
581
758
|
/***/ }),
|
|
582
759
|
|
|
583
760
|
/***/ "./src/function.ts":
|
|
@@ -590,12 +767,21 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
590
767
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
591
768
|
/* harmony export */ delay: () => (/* binding */ delay),
|
|
592
769
|
/* harmony export */ invokeIfFunction: () => (/* binding */ invokeIfFunction),
|
|
770
|
+
/* harmony export */ isFunction: () => (/* binding */ isFunction),
|
|
593
771
|
/* harmony export */ noop: () => (/* binding */ noop),
|
|
594
772
|
/* harmony export */ not: () => (/* binding */ not),
|
|
595
773
|
/* harmony export */ retry: () => (/* binding */ retry),
|
|
596
774
|
/* harmony export */ timeout: () => (/* binding */ timeout)
|
|
597
775
|
/* harmony export */ });
|
|
598
776
|
const noop = () => { };
|
|
777
|
+
/**
|
|
778
|
+
* Checks if a value is a function.
|
|
779
|
+
*
|
|
780
|
+
* @param value - The value to check.
|
|
781
|
+
*
|
|
782
|
+
* @returns `true` if the value is a function; otherwise, `false`.
|
|
783
|
+
*/
|
|
784
|
+
const isFunction = (value) => typeof value === 'function';
|
|
599
785
|
/**
|
|
600
786
|
* Creates a function that negates the result of the given predicate function.
|
|
601
787
|
*
|
|
@@ -763,25 +949,19 @@ const retry = (task, { maxAttempts = 3, delayMs = 300, backoff = true, onRetry }
|
|
|
763
949
|
__webpack_require__.r(__webpack_exports__);
|
|
764
950
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
765
951
|
/* harmony export */ assert: () => (/* binding */ assert),
|
|
766
|
-
/* harmony export */ isArray: () => (/* binding */ isArray),
|
|
767
952
|
/* harmony export */ isBool: () => (/* binding */ isBool),
|
|
768
953
|
/* harmony export */ isDate: () => (/* binding */ isDate),
|
|
769
954
|
/* harmony export */ isDefined: () => (/* binding */ isDefined),
|
|
770
|
-
/* harmony export */ isEmptyArray: () => (/* binding */ isEmptyArray),
|
|
771
955
|
/* harmony export */ isEmptyObject: () => (/* binding */ isEmptyObject),
|
|
772
956
|
/* harmony export */ isFiniteNumber: () => (/* binding */ isFiniteNumber),
|
|
773
|
-
/* harmony export */ isFunction: () => (/* binding */ isFunction),
|
|
774
957
|
/* harmony export */ isInteger: () => (/* binding */ isInteger),
|
|
775
958
|
/* harmony export */ isMap: () => (/* binding */ isMap),
|
|
776
959
|
/* harmony export */ isNil: () => (/* binding */ isNil),
|
|
777
|
-
/* harmony export */ isNilOrEmptyString: () => (/* binding */ isNilOrEmptyString),
|
|
778
960
|
/* harmony export */ isNull: () => (/* binding */ isNull),
|
|
779
961
|
/* harmony export */ isNumber: () => (/* binding */ isNumber),
|
|
780
962
|
/* harmony export */ isObject: () => (/* binding */ isObject),
|
|
781
|
-
/* harmony export */ isPromise: () => (/* binding */ isPromise),
|
|
782
963
|
/* harmony export */ isRegExp: () => (/* binding */ isRegExp),
|
|
783
964
|
/* harmony export */ isSet: () => (/* binding */ isSet),
|
|
784
|
-
/* harmony export */ isString: () => (/* binding */ isString),
|
|
785
965
|
/* harmony export */ isSymbol: () => (/* binding */ isSymbol),
|
|
786
966
|
/* harmony export */ isUndefined: () => (/* binding */ isUndefined),
|
|
787
967
|
/* harmony export */ isValidDate: () => (/* binding */ isValidDate)
|
|
@@ -807,19 +987,6 @@ const isNull = (value) => value === null;
|
|
|
807
987
|
* @returns `true` if the value is `null` or `undefined`, otherwise `false`.
|
|
808
988
|
*/
|
|
809
989
|
const isNil = (value) => value === undefined || value === null;
|
|
810
|
-
/**
|
|
811
|
-
* Checks whether the provided value is considered "empty".
|
|
812
|
-
*
|
|
813
|
-
* A value is considered empty if it is:
|
|
814
|
-
* - `null`
|
|
815
|
-
* - `undefined`
|
|
816
|
-
* - `''`
|
|
817
|
-
*
|
|
818
|
-
* @param value - The value to check.
|
|
819
|
-
*
|
|
820
|
-
* @returns `true` if the value is empty; otherwise, `false`.
|
|
821
|
-
*/
|
|
822
|
-
const isNilOrEmptyString = (value) => value === '' || isNil(value);
|
|
823
990
|
/**
|
|
824
991
|
* Checks if a value is neither `null` nor `undefined`.
|
|
825
992
|
*
|
|
@@ -828,14 +995,6 @@ const isNilOrEmptyString = (value) => value === '' || isNil(value);
|
|
|
828
995
|
* @returns `true` if the value is defined (not `null` or `undefined`); otherwise, `false`.
|
|
829
996
|
*/
|
|
830
997
|
const isDefined = (value) => value !== null && value !== undefined;
|
|
831
|
-
/**
|
|
832
|
-
* Checks if a value is a string.
|
|
833
|
-
*
|
|
834
|
-
* @param value - The value to check.
|
|
835
|
-
*
|
|
836
|
-
* @returns `true` if the value is a string; otherwise, `false`.
|
|
837
|
-
*/
|
|
838
|
-
const isString = (value) => typeof value === 'string';
|
|
839
998
|
/**
|
|
840
999
|
* Checks if a value is a number.
|
|
841
1000
|
*
|
|
@@ -868,40 +1027,6 @@ const isObject = (value) => typeof value === 'object';
|
|
|
868
1027
|
* @returns `true` if the value is an empty object; otherwise, `false`.
|
|
869
1028
|
*/
|
|
870
1029
|
const isEmptyObject = (value) => isObject(value) && !isNull(value) && Object.keys(value).length === 0;
|
|
871
|
-
/**
|
|
872
|
-
* Checks if a value is an array.
|
|
873
|
-
*
|
|
874
|
-
* @param value - The value to check.
|
|
875
|
-
*
|
|
876
|
-
* @returns `true` if the value is an array; otherwise, `false`.
|
|
877
|
-
*/
|
|
878
|
-
const isArray = (value) => Array.isArray(value);
|
|
879
|
-
/**
|
|
880
|
-
* Checks if a value is an empty array.
|
|
881
|
-
*
|
|
882
|
-
* @param value - The value to check.
|
|
883
|
-
*
|
|
884
|
-
* @returns `true` if the value is an empty array; otherwise, `false`.
|
|
885
|
-
*/
|
|
886
|
-
const isEmptyArray = (value) => isArray(value) && value.length === 0;
|
|
887
|
-
/**
|
|
888
|
-
* Checks if a value is a function.
|
|
889
|
-
*
|
|
890
|
-
* @param value - The value to check.
|
|
891
|
-
*
|
|
892
|
-
* @returns `true` if the value is a function; otherwise, `false`.
|
|
893
|
-
*/
|
|
894
|
-
const isFunction = (value) => typeof value === 'function';
|
|
895
|
-
/**
|
|
896
|
-
* Checks if a value is a Promise.
|
|
897
|
-
*
|
|
898
|
-
* @template T - The type of the value that the Promise resolves to.
|
|
899
|
-
*
|
|
900
|
-
* @param value - The value to check.
|
|
901
|
-
*
|
|
902
|
-
* @returns `true` if the value is a Promise; otherwise, `false`.
|
|
903
|
-
*/
|
|
904
|
-
const isPromise = (value) => isFunction(value?.then);
|
|
905
1030
|
/**
|
|
906
1031
|
* Checks if a value is a Date object.
|
|
907
1032
|
*
|
|
@@ -1040,9 +1165,34 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1040
1165
|
/* harmony export */ camelToDashCase: () => (/* binding */ camelToDashCase),
|
|
1041
1166
|
/* harmony export */ camelToWords: () => (/* binding */ camelToWords),
|
|
1042
1167
|
/* harmony export */ hashString: () => (/* binding */ hashString),
|
|
1168
|
+
/* harmony export */ isNilOrEmptyString: () => (/* binding */ isNilOrEmptyString),
|
|
1169
|
+
/* harmony export */ isString: () => (/* binding */ isString),
|
|
1043
1170
|
/* harmony export */ splitStringIntoWords: () => (/* binding */ splitStringIntoWords),
|
|
1044
1171
|
/* harmony export */ toKebabCase: () => (/* binding */ toKebabCase)
|
|
1045
1172
|
/* harmony export */ });
|
|
1173
|
+
/* harmony import */ var _guards__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./guards */ "./src/guards.ts");
|
|
1174
|
+
|
|
1175
|
+
/**
|
|
1176
|
+
* Checks if a value is a string.
|
|
1177
|
+
*
|
|
1178
|
+
* @param value - The value to check.
|
|
1179
|
+
*
|
|
1180
|
+
* @returns `true` if the value is a string; otherwise, `false`.
|
|
1181
|
+
*/
|
|
1182
|
+
const isString = (value) => typeof value === 'string';
|
|
1183
|
+
/**
|
|
1184
|
+
* Checks whether the provided value is considered "empty".
|
|
1185
|
+
*
|
|
1186
|
+
* A value is considered empty if it is:
|
|
1187
|
+
* - `null`
|
|
1188
|
+
* - `undefined`
|
|
1189
|
+
* - `''`
|
|
1190
|
+
*
|
|
1191
|
+
* @param value - The value to check.
|
|
1192
|
+
*
|
|
1193
|
+
* @returns `true` if the value is empty; otherwise, `false`.
|
|
1194
|
+
*/
|
|
1195
|
+
const isNilOrEmptyString = (value) => value === '' || (0,_guards__WEBPACK_IMPORTED_MODULE_0__.isNil)(value);
|
|
1046
1196
|
/**
|
|
1047
1197
|
* Converts a string to kebab-case format.
|
|
1048
1198
|
*
|
|
@@ -1218,6 +1368,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1218
1368
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1219
1369
|
/* harmony export */ FOCUSABLE_HTML_TAGS: () => (/* reexport safe */ _dom__WEBPACK_IMPORTED_MODULE_6__.FOCUSABLE_HTML_TAGS),
|
|
1220
1370
|
/* harmony export */ assert: () => (/* reexport safe */ _guards__WEBPACK_IMPORTED_MODULE_4__.assert),
|
|
1371
|
+
/* harmony export */ blobToFile: () => (/* reexport safe */ _file__WEBPACK_IMPORTED_MODULE_7__.blobToFile),
|
|
1221
1372
|
/* harmony export */ calculateEuclideanDistance: () => (/* reexport safe */ _math__WEBPACK_IMPORTED_MODULE_5__.calculateEuclideanDistance),
|
|
1222
1373
|
/* harmony export */ calculateMovingSpeed: () => (/* reexport safe */ _math__WEBPACK_IMPORTED_MODULE_5__.calculateMovingSpeed),
|
|
1223
1374
|
/* harmony export */ calculatePercentage: () => (/* reexport safe */ _math__WEBPACK_IMPORTED_MODULE_5__.calculatePercentage),
|
|
@@ -1227,10 +1378,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1227
1378
|
/* harmony export */ cloneBlob: () => (/* reexport safe */ _dom__WEBPACK_IMPORTED_MODULE_6__.cloneBlob),
|
|
1228
1379
|
/* harmony export */ compact: () => (/* reexport safe */ _array__WEBPACK_IMPORTED_MODULE_2__.compact),
|
|
1229
1380
|
/* harmony export */ compose: () => (/* reexport safe */ _array__WEBPACK_IMPORTED_MODULE_2__.compose),
|
|
1230
|
-
/* harmony export */ convertBlobToFile: () => (/* reexport safe */ _dom__WEBPACK_IMPORTED_MODULE_6__.convertBlobToFile),
|
|
1231
1381
|
/* harmony export */ delay: () => (/* reexport safe */ _function__WEBPACK_IMPORTED_MODULE_3__.delay),
|
|
1232
1382
|
/* harmony export */ difference: () => (/* reexport safe */ _array__WEBPACK_IMPORTED_MODULE_2__.difference),
|
|
1233
1383
|
/* harmony export */ everyAsync: () => (/* reexport safe */ _async__WEBPACK_IMPORTED_MODULE_0__.everyAsync),
|
|
1384
|
+
/* harmony export */ fileListToFiles: () => (/* reexport safe */ _file__WEBPACK_IMPORTED_MODULE_7__.fileListToFiles),
|
|
1234
1385
|
/* harmony export */ filterParallel: () => (/* reexport safe */ _async__WEBPACK_IMPORTED_MODULE_0__.filterParallel),
|
|
1235
1386
|
/* harmony export */ filterSequential: () => (/* reexport safe */ _async__WEBPACK_IMPORTED_MODULE_0__.filterSequential),
|
|
1236
1387
|
/* harmony export */ findAsync: () => (/* reexport safe */ _async__WEBPACK_IMPORTED_MODULE_0__.findAsync),
|
|
@@ -1241,33 +1392,35 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1241
1392
|
/* harmony export */ intersection: () => (/* reexport safe */ _array__WEBPACK_IMPORTED_MODULE_2__.intersection),
|
|
1242
1393
|
/* harmony export */ invokeIfFunction: () => (/* reexport safe */ _function__WEBPACK_IMPORTED_MODULE_3__.invokeIfFunction),
|
|
1243
1394
|
/* harmony export */ isAnchorHtmlElement: () => (/* reexport safe */ _dom__WEBPACK_IMPORTED_MODULE_6__.isAnchorHtmlElement),
|
|
1244
|
-
/* harmony export */ isArray: () => (/* reexport safe */
|
|
1395
|
+
/* harmony export */ isArray: () => (/* reexport safe */ _array__WEBPACK_IMPORTED_MODULE_2__.isArray),
|
|
1245
1396
|
/* harmony export */ isBool: () => (/* reexport safe */ _guards__WEBPACK_IMPORTED_MODULE_4__.isBool),
|
|
1246
1397
|
/* harmony export */ isContentEditableHtmlElement: () => (/* reexport safe */ _dom__WEBPACK_IMPORTED_MODULE_6__.isContentEditableHtmlElement),
|
|
1247
1398
|
/* harmony export */ isDate: () => (/* reexport safe */ _guards__WEBPACK_IMPORTED_MODULE_4__.isDate),
|
|
1248
1399
|
/* harmony export */ isDefined: () => (/* reexport safe */ _guards__WEBPACK_IMPORTED_MODULE_4__.isDefined),
|
|
1249
|
-
/* harmony export */ isEmptyArray: () => (/* reexport safe */
|
|
1400
|
+
/* harmony export */ isEmptyArray: () => (/* reexport safe */ _array__WEBPACK_IMPORTED_MODULE_2__.isEmptyArray),
|
|
1250
1401
|
/* harmony export */ isEmptyObject: () => (/* reexport safe */ _guards__WEBPACK_IMPORTED_MODULE_4__.isEmptyObject),
|
|
1402
|
+
/* harmony export */ isFile: () => (/* reexport safe */ _file__WEBPACK_IMPORTED_MODULE_7__.isFile),
|
|
1251
1403
|
/* harmony export */ isFiniteNumber: () => (/* reexport safe */ _guards__WEBPACK_IMPORTED_MODULE_4__.isFiniteNumber),
|
|
1252
|
-
/* harmony export */ isFunction: () => (/* reexport safe */
|
|
1404
|
+
/* harmony export */ isFunction: () => (/* reexport safe */ _function__WEBPACK_IMPORTED_MODULE_3__.isFunction),
|
|
1253
1405
|
/* harmony export */ isHtmlElementFocusable: () => (/* reexport safe */ _dom__WEBPACK_IMPORTED_MODULE_6__.isHtmlElementFocusable),
|
|
1254
1406
|
/* harmony export */ isInteger: () => (/* reexport safe */ _guards__WEBPACK_IMPORTED_MODULE_4__.isInteger),
|
|
1255
1407
|
/* harmony export */ isMap: () => (/* reexport safe */ _guards__WEBPACK_IMPORTED_MODULE_4__.isMap),
|
|
1256
1408
|
/* harmony export */ isNil: () => (/* reexport safe */ _guards__WEBPACK_IMPORTED_MODULE_4__.isNil),
|
|
1257
|
-
/* harmony export */ isNilOrEmptyString: () => (/* reexport safe */
|
|
1409
|
+
/* harmony export */ isNilOrEmptyString: () => (/* reexport safe */ _string__WEBPACK_IMPORTED_MODULE_1__.isNilOrEmptyString),
|
|
1258
1410
|
/* harmony export */ isNull: () => (/* reexport safe */ _guards__WEBPACK_IMPORTED_MODULE_4__.isNull),
|
|
1259
1411
|
/* harmony export */ isNumber: () => (/* reexport safe */ _guards__WEBPACK_IMPORTED_MODULE_4__.isNumber),
|
|
1260
1412
|
/* harmony export */ isObject: () => (/* reexport safe */ _guards__WEBPACK_IMPORTED_MODULE_4__.isObject),
|
|
1261
|
-
/* harmony export */ isPromise: () => (/* reexport safe */
|
|
1413
|
+
/* harmony export */ isPromise: () => (/* reexport safe */ _async__WEBPACK_IMPORTED_MODULE_0__.isPromise),
|
|
1262
1414
|
/* harmony export */ isRegExp: () => (/* reexport safe */ _guards__WEBPACK_IMPORTED_MODULE_4__.isRegExp),
|
|
1263
1415
|
/* harmony export */ isSet: () => (/* reexport safe */ _guards__WEBPACK_IMPORTED_MODULE_4__.isSet),
|
|
1264
|
-
/* harmony export */ isString: () => (/* reexport safe */
|
|
1416
|
+
/* harmony export */ isString: () => (/* reexport safe */ _string__WEBPACK_IMPORTED_MODULE_1__.isString),
|
|
1265
1417
|
/* harmony export */ isSymbol: () => (/* reexport safe */ _guards__WEBPACK_IMPORTED_MODULE_4__.isSymbol),
|
|
1266
1418
|
/* harmony export */ isUndefined: () => (/* reexport safe */ _guards__WEBPACK_IMPORTED_MODULE_4__.isUndefined),
|
|
1267
1419
|
/* harmony export */ isValidDate: () => (/* reexport safe */ _guards__WEBPACK_IMPORTED_MODULE_4__.isValidDate),
|
|
1268
1420
|
/* harmony export */ noop: () => (/* reexport safe */ _function__WEBPACK_IMPORTED_MODULE_3__.noop),
|
|
1269
1421
|
/* harmony export */ not: () => (/* reexport safe */ _function__WEBPACK_IMPORTED_MODULE_3__.not),
|
|
1270
1422
|
/* harmony export */ parse2DMatrix: () => (/* reexport safe */ _dom__WEBPACK_IMPORTED_MODULE_6__.parse2DMatrix),
|
|
1423
|
+
/* harmony export */ parseFileName: () => (/* reexport safe */ _file__WEBPACK_IMPORTED_MODULE_7__.parseFileName),
|
|
1271
1424
|
/* harmony export */ pipe: () => (/* reexport safe */ _array__WEBPACK_IMPORTED_MODULE_2__.pipe),
|
|
1272
1425
|
/* harmony export */ reduceAsync: () => (/* reexport safe */ _async__WEBPACK_IMPORTED_MODULE_0__.reduceAsync),
|
|
1273
1426
|
/* harmony export */ retry: () => (/* reexport safe */ _function__WEBPACK_IMPORTED_MODULE_3__.retry),
|
|
@@ -1277,6 +1430,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1277
1430
|
/* harmony export */ splitStringIntoWords: () => (/* reexport safe */ _string__WEBPACK_IMPORTED_MODULE_1__.splitStringIntoWords),
|
|
1278
1431
|
/* harmony export */ timeout: () => (/* reexport safe */ _function__WEBPACK_IMPORTED_MODULE_3__.timeout),
|
|
1279
1432
|
/* harmony export */ toKebabCase: () => (/* reexport safe */ _string__WEBPACK_IMPORTED_MODULE_1__.toKebabCase),
|
|
1433
|
+
/* harmony export */ traverseFileSystemDirectory: () => (/* reexport safe */ _file__WEBPACK_IMPORTED_MODULE_7__.traverseFileSystemDirectory),
|
|
1280
1434
|
/* harmony export */ unique: () => (/* reexport safe */ _array__WEBPACK_IMPORTED_MODULE_2__.unique)
|
|
1281
1435
|
/* harmony export */ });
|
|
1282
1436
|
/* harmony import */ var _async__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./async */ "./src/async.ts");
|
|
@@ -1286,6 +1440,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1286
1440
|
/* harmony import */ var _guards__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./guards */ "./src/guards.ts");
|
|
1287
1441
|
/* harmony import */ var _math__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./math */ "./src/math.ts");
|
|
1288
1442
|
/* harmony import */ var _dom__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./dom */ "./src/dom.ts");
|
|
1443
|
+
/* harmony import */ var _file__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./file */ "./src/file.ts");
|
|
1444
|
+
|
|
1289
1445
|
|
|
1290
1446
|
|
|
1291
1447
|
|