@rzl-zone/utils-js 2.1.0 → 3.0.1-beta.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/dist/NumberRangeUnion-DC-C3_Kq.d.ts +26 -0
- package/dist/any-BmdI8UbK.d.ts +67 -0
- package/dist/array-CIZRbqTF.d.ts +223 -0
- package/dist/arrays-normalize-recursive-CnjYJ9xg.d.ts +72 -0
- package/dist/assertions/index.cjs +1 -0
- package/dist/assertions/index.d.ts +428 -0
- package/dist/assertions/index.js +1 -0
- package/dist/chunk-2TRAPBZ7.cjs +1 -0
- package/dist/chunk-4DK3RCC4.js +2 -0
- package/dist/chunk-4JOQ45HL.js +1 -0
- package/dist/chunk-55CZALRS.js +1 -0
- package/dist/chunk-56QBKKRE.js +1 -0
- package/dist/chunk-5SZUSNGZ.js +1 -0
- package/dist/chunk-62HX5Z45.cjs +1 -0
- package/dist/chunk-7NA6DUHR.cjs +2 -0
- package/dist/chunk-7YWAQOA4.cjs +1 -0
- package/dist/chunk-BVPMMWDL.cjs +1 -0
- package/dist/chunk-BYZAD3XN.cjs +1 -0
- package/dist/chunk-CEFYHEM4.cjs +1 -0
- package/dist/chunk-CN53M4QZ.cjs +1 -0
- package/dist/chunk-D47MHBSD.cjs +1 -0
- package/dist/chunk-DGH75GJD.js +1 -0
- package/dist/chunk-E5NUI7PN.js +1 -0
- package/dist/chunk-ELDDNERR.js +1 -0
- package/dist/chunk-EXZ47NOW.js +1 -0
- package/dist/chunk-FDITZ5C6.cjs +1 -0
- package/dist/chunk-FF76ISQ2.js +1 -0
- package/dist/chunk-FIEZKTAZ.cjs +1 -0
- package/dist/chunk-FSSV24W7.cjs +1 -0
- package/dist/chunk-G5LXIEFO.js +0 -0
- package/dist/chunk-GCGU2WB7.js +1 -0
- package/dist/chunk-GECI2YBP.js +1 -0
- package/dist/chunk-GQE4OVHC.cjs +1 -0
- package/dist/chunk-GRVZXQXL.cjs +1 -0
- package/dist/chunk-I4AVNHPA.cjs +1 -0
- package/dist/chunk-JWHM3WZQ.cjs +1 -0
- package/dist/chunk-KBKYG3IY.cjs +1 -0
- package/dist/chunk-KCQDDZJE.cjs +1 -0
- package/dist/chunk-LVKAYEZ4.js +1 -0
- package/dist/chunk-MBDWTK54.cjs +1 -0
- package/dist/chunk-MMSYCIJ2.cjs +1 -0
- package/dist/chunk-MNGGDB2G.js +1 -0
- package/dist/chunk-MY7BA4GI.cjs +1 -0
- package/dist/chunk-N2IJPIND.cjs +1 -0
- package/dist/chunk-NIMNTEGV.js +1 -0
- package/dist/chunk-NNM7QCNB.js +1 -0
- package/dist/chunk-POCPQYZS.js +1 -0
- package/dist/chunk-PUQXRLZH.cjs +1 -0
- package/dist/chunk-PVJF2JHM.js +1 -0
- package/dist/chunk-QCFXEUKL.js +1 -0
- package/dist/chunk-QFCGBBSY.js +1 -0
- package/dist/chunk-QQYAUPSK.cjs +1 -0
- package/dist/chunk-RN3TP3S3.js +1 -0
- package/dist/chunk-RV2VULM7.cjs +1 -0
- package/dist/chunk-SW6HYEW7.cjs +1 -0
- package/dist/chunk-SYJC7UAW.js +1 -0
- package/dist/chunk-TC4VBE4Y.cjs +1 -0
- package/dist/chunk-TUXDINHF.cjs +1 -0
- package/dist/chunk-U5Y2FXMN.cjs +1 -0
- package/dist/chunk-UUPQI6ND.cjs +1 -0
- package/dist/chunk-VYCGZ2S6.js +1 -0
- package/dist/chunk-W5EDKJK3.js +1 -0
- package/dist/chunk-WHAVUFEU.js +1 -0
- package/dist/chunk-X3GTRVVK.cjs +4 -0
- package/dist/chunk-XCFIOTCV.js +1 -0
- package/dist/chunk-XE27XPJR.js +1 -0
- package/dist/chunk-XH6MCRLP.js +1 -0
- package/dist/chunk-XVB3ZZEB.js +1 -0
- package/dist/chunk-YEERJDOF.js +4 -0
- package/dist/chunk-ZBSIGJFO.cjs +1 -0
- package/dist/chunk-ZYAML74V.js +1 -0
- package/dist/conversions/index.cjs +1 -0
- package/dist/conversions/index.d.ts +1633 -0
- package/dist/conversions/index.js +1 -0
- package/dist/env/index.cjs +1 -0
- package/dist/env/index.d.ts +19 -0
- package/dist/env/index.js +1 -0
- package/dist/events/index.cjs +1 -0
- package/dist/events/index.d.ts +119 -0
- package/dist/events/index.js +1 -0
- package/dist/extends-Mp81Hq9-.d.ts +145 -0
- package/dist/formatting/index.cjs +1 -0
- package/dist/formatting/index.d.ts +912 -0
- package/dist/formatting/index.js +1 -0
- package/dist/generator/index.cjs +1 -0
- package/dist/generator/index.d.ts +163 -0
- package/dist/generator/index.js +1 -0
- package/dist/if-CvT4R7Kh.d.ts +18 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -4334
- package/dist/index.js +1 -1
- package/dist/is-array-Ckm_47hw.d.ts +1557 -0
- package/dist/isPlainObject-BKYaI6a8.d.ts +182 -0
- package/dist/never-BfayMBF9.d.ts +75 -0
- package/dist/next/index.cjs +8 -1
- package/dist/next/index.d.ts +169 -169
- package/dist/next/index.js +8 -1
- package/dist/next/server/index.cjs +2 -1
- package/dist/next/server/index.d.ts +37 -37
- package/dist/next/server/index.js +2 -1
- package/dist/nils-DMz3kU7M.d.ts +177 -0
- package/dist/omit-VvmIsZmX.d.ts +28 -0
- package/dist/operations/index.cjs +1 -0
- package/dist/operations/index.d.ts +182 -0
- package/dist/operations/index.js +1 -0
- package/dist/parsers/index.cjs +1 -0
- package/dist/parsers/index.d.ts +37 -0
- package/dist/parsers/index.js +1 -0
- package/dist/predicates/index.cjs +1 -0
- package/dist/predicates/index.d.ts +1839 -0
- package/dist/predicates/index.js +1 -0
- package/dist/prettify-C4xLcYOP.d.ts +353 -0
- package/dist/promise/index.cjs +1 -0
- package/dist/promise/index.d.ts +40 -0
- package/dist/promise/index.js +1 -0
- package/dist/rzl-utils.global.js +4 -1
- package/dist/strings/index.cjs +1 -0
- package/dist/strings/index.d.ts +816 -0
- package/dist/strings/index.js +1 -0
- package/dist/stylings/index.cjs +1 -0
- package/dist/stylings/index.d.ts +49 -0
- package/dist/stylings/index.js +1 -0
- package/dist/type-data-DDs-u2kq.d.ts +261 -0
- package/dist/types/index.d.ts +3589 -2090
- package/dist/urls/index.cjs +1 -0
- package/dist/urls/index.d.ts +416 -0
- package/dist/urls/index.js +1 -0
- package/package.json +147 -21
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{f as convertType,g as removeObjectPaths,b as toBooleanContent,c as toBooleanContentDeep,d as toBooleanExplicit,e as toBooleanLoose,a as toNumberArrayUnRecursive,h as toNumberDeep,i as toStringDeep}from'../chunk-VYCGZ2S6.js';export{b as cleanParsedData,a as extractDigits,c as parseCustomDate,d as safeJsonParse}from'../chunk-PVJF2JHM.js';import'../chunk-DGH75GJD.js';export{d as dedupeArray,b as filterNilArray,c as filterNullArray,e as toStringArrayUnRecursive,a as toStringDeepForce}from'../chunk-WHAVUFEU.js';import'../chunk-ZYAML74V.js';import'../chunk-W5EDKJK3.js';import'../chunk-QFCGBBSY.js';export{a as parseCurrencyString}from'../chunk-XH6MCRLP.js';import'../chunk-4JOQ45HL.js';import'../chunk-SYJC7UAW.js';import'../chunk-NIMNTEGV.js';import'../chunk-XVB3ZZEB.js';export{c as safeStableStringify}from'../chunk-MNGGDB2G.js';import'../chunk-5SZUSNGZ.js';import'../chunk-XCFIOTCV.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';require('../chunk-MMSYCIJ2.cjs');var chunkSW6HYEW7_cjs=require('../chunk-SW6HYEW7.cjs');Object.defineProperty(exports,"isServer",{enumerable:true,get:function(){return chunkSW6HYEW7_cjs.a}});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** ----------------------------------------
|
|
2
|
+
* * ***Detects if the current environment is server-side (Node.js) or client-side (browser).***
|
|
3
|
+
* ----------------------------------------
|
|
4
|
+
*
|
|
5
|
+
* Determines whether the code is running in a Node.js environment (server)
|
|
6
|
+
* or in a browser environment (client).
|
|
7
|
+
*
|
|
8
|
+
* @returns {boolean}
|
|
9
|
+
* - `true` → running on the **server-side** (Node.js).
|
|
10
|
+
* - `false` → running on the **client-side** (browser).
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* if (isServer()) {
|
|
14
|
+
* console.log("Running on Node.js");
|
|
15
|
+
* } else {
|
|
16
|
+
* console.log("Running in the browser");
|
|
17
|
+
* }
|
|
18
|
+
*/
|
|
19
|
+
declare const isServer:()=>boolean;export{isServer};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import'../chunk-G5LXIEFO.js';export{a as isServer}from'../chunk-56QBKKRE.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkGQE4OVHC_cjs=require('../chunk-GQE4OVHC.cjs');require('../chunk-SW6HYEW7.cjs'),require('../chunk-BVPMMWDL.cjs'),require('../chunk-CN53M4QZ.cjs');Object.defineProperty(exports,"disableUserInteraction",{enumerable:true,get:function(){return chunkGQE4OVHC_cjs.a}});Object.defineProperty(exports,"enableUserInteraction",{enumerable:true,get:function(){return chunkGQE4OVHC_cjs.b}});Object.defineProperty(exports,"removeElementFocus",{enumerable:true,get:function(){return chunkGQE4OVHC_cjs.c}});Object.defineProperty(exports,"scrollToTop",{enumerable:true,get:function(){return chunkGQE4OVHC_cjs.d}});
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
type ScrollToTopOptions={
|
|
2
|
+
/** `"auto" | "instant" | "smooth"` defaults value `"smooth"` */
|
|
3
|
+
behavior?:ScrollBehavior|undefined;
|
|
4
|
+
/** `number | undefined` defaults value `1` as `ms` */
|
|
5
|
+
timeout?:number|undefined;};
|
|
6
|
+
/** ----------------------------------------------------------
|
|
7
|
+
* * ***Disables user interaction by adding a CSS class to the `<html>` element.***
|
|
8
|
+
* ----------------------------------------------------------
|
|
9
|
+
*
|
|
10
|
+
* Key points:
|
|
11
|
+
* - Works **only in browser environments**.
|
|
12
|
+
* - Safely adds the specified CSS class to `<html>`.
|
|
13
|
+
* - Prevents multiple additions of the same class.
|
|
14
|
+
* - Useful to indicate that a process is ongoing
|
|
15
|
+
* (e.g., loading or processing state).
|
|
16
|
+
*
|
|
17
|
+
* **Using custom CSS classes:**
|
|
18
|
+
* - You can pass any class name that exists in your CSS.
|
|
19
|
+
* - Example: if you have `.loading` in your styles, passing `"loading"`
|
|
20
|
+
* will add it and disable interactions accordingly.
|
|
21
|
+
*
|
|
22
|
+
* **Validation:**
|
|
23
|
+
* - Throws `TypeError` if the `className` parameter is not a string.
|
|
24
|
+
*
|
|
25
|
+
* @param {string} [className="on_processing"] - The CSS class to add. Defaults to `"on_processing"`.
|
|
26
|
+
*
|
|
27
|
+
* @returns {void} Does not return anything.
|
|
28
|
+
*
|
|
29
|
+
* @throws {TypeError} If `className` is not a string.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* disableUserInteraction(); // Adds "on_processing" class
|
|
33
|
+
* disableUserInteraction("loading"); // Adds "loading" class
|
|
34
|
+
* // ❌ Invalid value:
|
|
35
|
+
* disableUserInteraction(123); // Throws TypeError
|
|
36
|
+
*/
|
|
37
|
+
declare const disableUserInteraction:(className?:string)=>void;
|
|
38
|
+
/** ----------------------------------------------------------
|
|
39
|
+
* * ***Enables user interaction by removing a CSS class from the `<html>` element.***
|
|
40
|
+
* ----------------------------------------------------------
|
|
41
|
+
*
|
|
42
|
+
* Key points:
|
|
43
|
+
* - Works **only in browser environments**.
|
|
44
|
+
* - Safely removes the specified CSS class from `<html>`.
|
|
45
|
+
* - Does nothing if the class is not present.
|
|
46
|
+
* - Useful to re-enable user interactions after a process
|
|
47
|
+
* (e.g., loading or processing) completes.
|
|
48
|
+
*
|
|
49
|
+
* **Using custom CSS classes:**
|
|
50
|
+
* - You can pass any class name that exists in your CSS.
|
|
51
|
+
* - Example: if you have `.loading` in your styles, passing `"loading"`
|
|
52
|
+
* will remove it and re-enable interactions.
|
|
53
|
+
*
|
|
54
|
+
* **Validation:**
|
|
55
|
+
* - Throws `TypeError` if the `className` parameter is not a string.
|
|
56
|
+
*
|
|
57
|
+
* @param {string} [className="on_processing"] - The CSS class to remove. Defaults to `"on_processing"`.
|
|
58
|
+
*
|
|
59
|
+
* @returns {void} Does not return anything.
|
|
60
|
+
*
|
|
61
|
+
* @throws {TypeError} If `className` is not a string.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* enableUserInteraction(); // ➔ Removes "on_processing" class
|
|
65
|
+
* enableUserInteraction("loading"); // ➔ Removes "loading" class
|
|
66
|
+
* // ➔ ❌ Invalid value:
|
|
67
|
+
* enableUserInteraction(123); // ➔ Throws TypeError
|
|
68
|
+
*/
|
|
69
|
+
declare const enableUserInteraction:(className?:string)=>void;
|
|
70
|
+
/** ----------------------------------------------------------
|
|
71
|
+
* * ***Removes focus from the currently active element in the document.***
|
|
72
|
+
* ----------------------------------------------------------
|
|
73
|
+
*
|
|
74
|
+
* - This function works **only in browser environments**.
|
|
75
|
+
* - If an element is focused, it will lose focus by calling `blur()`.
|
|
76
|
+
* - If no element is focused or the active element is not an `HTMLElement`, nothing happens.
|
|
77
|
+
*
|
|
78
|
+
* @returns {void} Does not return anything.
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* removeElementFocus(); // Removes focus from the currently active element
|
|
82
|
+
*/
|
|
83
|
+
declare const removeElementFocus:()=>void;
|
|
84
|
+
/** ----------------------------------------------------------
|
|
85
|
+
* * ***Scrolls the page to the top with optional smooth animation and delay.***
|
|
86
|
+
* ----------------------------------------------------------
|
|
87
|
+
*
|
|
88
|
+
* - This function works **only in browser environments** (no effect on server-side).
|
|
89
|
+
* - It leverages the native `window.scrollTo()` API with support for smooth scrolling
|
|
90
|
+
* and an optional timeout delay before executing the scroll.
|
|
91
|
+
*
|
|
92
|
+
* Each option has strict valid values. If an invalid value is provided, the function
|
|
93
|
+
* **automatically falls back to its default**.
|
|
94
|
+
*
|
|
95
|
+
* @param {ScrollToTopOptions} [options] - Optional settings for scroll behavior.
|
|
96
|
+
* @param {ScrollBehavior} [options.behavior="smooth"] - Scroll animation type.
|
|
97
|
+
* - Valid values: `"auto"`, `"instant"`, `"smooth"`.
|
|
98
|
+
* - Default: `"smooth"` if missing or invalid.
|
|
99
|
+
* @param {number} [options.timeout=1] - Delay before scrolling (in milliseconds).
|
|
100
|
+
* - Valid values: any number >= 1.
|
|
101
|
+
* - Default: `1` if missing, invalid, or less than 1.
|
|
102
|
+
*
|
|
103
|
+
* @returns {void} Does not return anything.
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* // Scroll smoothly to the top after 1ms delay
|
|
107
|
+
* scrollToTop();
|
|
108
|
+
*
|
|
109
|
+
* // Jump instantly to the top
|
|
110
|
+
* scrollToTop({ behavior: "instant" });
|
|
111
|
+
*
|
|
112
|
+
* // Scroll smoothly to the top after 500ms
|
|
113
|
+
* scrollToTop({ timeout: 500 });
|
|
114
|
+
*
|
|
115
|
+
* // ❌ Invalid options value:
|
|
116
|
+
* scrollToTop({ behavior: "fly", timeout: -100 });
|
|
117
|
+
* // Fallback: behavior="smooth", timeout=1
|
|
118
|
+
*/
|
|
119
|
+
declare const scrollToTop:(options?:ScrollToTopOptions)=>void;export{disableUserInteraction,enableUserInteraction,removeElementFocus,scrollToTop};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{a as disableUserInteraction,b as enableUserInteraction,c as removeElementFocus,d as scrollToTop}from'../chunk-RN3TP3S3.js';import'../chunk-56QBKKRE.js';import'../chunk-XVB3ZZEB.js';import'../chunk-XCFIOTCV.js';
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import{I as IsEmptyArray}from'./array-CIZRbqTF.js';import{I as If}from'./if-CvT4R7Kh.js';
|
|
2
|
+
/** -------------------------------------------------------
|
|
3
|
+
* * ***Not.***
|
|
4
|
+
* -------------------------------------------------------
|
|
5
|
+
* Accepts a boolean type `T` and returns its negation.
|
|
6
|
+
*
|
|
7
|
+
* @template T - Boolean type to negate.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* type A = Not<true>; // ➔ false
|
|
12
|
+
* type B = Not<false>; // ➔ true
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
type Not<T extends boolean>=T extends true?false:true;
|
|
16
|
+
/** -------------------------------------------------------
|
|
17
|
+
* * ***PopOptions.***
|
|
18
|
+
* -------------------------------------------------------
|
|
19
|
+
*
|
|
20
|
+
* Configuration options for the {@link Pop} type utility.
|
|
21
|
+
*/
|
|
22
|
+
type PopOptions={
|
|
23
|
+
/**
|
|
24
|
+
* If `true`, {@link Pop} will return a tuple `[Rest, Removed]`
|
|
25
|
+
* instead of just the remaining array.
|
|
26
|
+
*
|
|
27
|
+
* Default: `false`.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* type Options = { includeRemoved: true };
|
|
32
|
+
* type Result = Pop<[1, 2, 3], Options>; // ➔ [[1, 2], 3]
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
includeRemoved:boolean;};
|
|
36
|
+
/** -------------------------------------------------------
|
|
37
|
+
* * ***Pop.***
|
|
38
|
+
* -------------------------------------------------------
|
|
39
|
+
*
|
|
40
|
+
* Removes the last element from a tuple/array type.
|
|
41
|
+
*
|
|
42
|
+
* If the `includeRemoved` option is `true`, it returns a tuple `[Rest, Removed]`
|
|
43
|
+
* where `Rest` is the array without the last element, and `Removed` is the last element.
|
|
44
|
+
*
|
|
45
|
+
* @template T - The tuple or array to pop from.
|
|
46
|
+
* @template Options - Configuration object. Default `{ includeRemoved: false }`.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```ts
|
|
50
|
+
* // Removes last element
|
|
51
|
+
* type Case1 = Pop<[1, 2, 3]>
|
|
52
|
+
* // ➔ [1, 2]
|
|
53
|
+
*
|
|
54
|
+
* // Removes last element and includes the removed value
|
|
55
|
+
* type Case2 = Pop<[1, 2, 3], { includeRemoved: true }>
|
|
56
|
+
* // ➔ [[1, 2], 3]
|
|
57
|
+
*
|
|
58
|
+
* // Edge case: empty array
|
|
59
|
+
* type Case3 = Pop<[]>
|
|
60
|
+
* // ➔ never
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
type Pop<T extends readonly unknown[],Options extends PopOptions={includeRemoved:false;}>=IsEmptyArray<T>extends true?never:T extends readonly [...infer Rest extends readonly unknown[],infer Removed]?If<Options["includeRemoved"],[Rest,Removed],Rest>:never;
|
|
64
|
+
/** -------------------------------------------------------
|
|
65
|
+
* * ***Extends.***
|
|
66
|
+
* -------------------------------------------------------
|
|
67
|
+
* Returns a boolean indicating whether the first argument ***extends*** the second argument.
|
|
68
|
+
*
|
|
69
|
+
* @template T - The type to check.
|
|
70
|
+
* @template Base - The type to compare against.
|
|
71
|
+
* @example
|
|
72
|
+
* ```ts
|
|
73
|
+
* type A = Extends<1, number>; // ➔ true
|
|
74
|
+
* type B = Extends<number, 1>; // ➔ false
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
type Extends<T,Base>=[T] extends [Base]?true:false;
|
|
78
|
+
/** -------------------------------------------------------
|
|
79
|
+
* * ***NotExtends.***
|
|
80
|
+
* -------------------------------------------------------
|
|
81
|
+
* Returns a boolean indicating whether the first argument does ***not extend*** the second argument.
|
|
82
|
+
*
|
|
83
|
+
* @template T - The type to check.
|
|
84
|
+
* @template Base - The type to compare against.
|
|
85
|
+
* @example
|
|
86
|
+
* ```ts
|
|
87
|
+
* type A = NotExtends<1, number>; // ➔ false
|
|
88
|
+
* type B = NotExtends<number, 1>; // ➔ true
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
type NotExtends<T,Base>=Not<Extends<T,Base>>;
|
|
92
|
+
/** -------------------------------------------------------
|
|
93
|
+
* * ***IfExtends.***
|
|
94
|
+
* -------------------------------------------------------
|
|
95
|
+
* Conditional: returns the third argument if the first argument ***extends*** the second argument, otherwise returns the fourth argument.
|
|
96
|
+
* - Defaults: `IfTrue = true`, `IfFalse = false`.
|
|
97
|
+
*
|
|
98
|
+
* @template T - The type to check.
|
|
99
|
+
* @template Base - The type to compare against.
|
|
100
|
+
* @template IfTrue - The branch type if condition is met. (default: `true`)
|
|
101
|
+
* @template IfFalse - The branch type if condition is not met. (default: `false`)
|
|
102
|
+
* @example
|
|
103
|
+
* ```ts
|
|
104
|
+
* type A = IfExtends<1, number, "valid">;
|
|
105
|
+
* // ➔ "valid"
|
|
106
|
+
* type B = IfExtends<1, string, "valid", "invalid">;
|
|
107
|
+
* // ➔ "invalid"
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
110
|
+
type IfExtends<T,Base,IfTrue=true,IfFalse=false>=If<Extends<T,Base>,IfTrue,IfFalse>;
|
|
111
|
+
/** -------------------------------------------------------
|
|
112
|
+
* * ***IfNotExtends.***
|
|
113
|
+
* -------------------------------------------------------
|
|
114
|
+
* Conditional: returns the third argument if the first argument does ***not extend*** the second argument, otherwise returns the fourth argument.
|
|
115
|
+
* - Defaults: `IfTrue = true`, `IfFalse = false`.
|
|
116
|
+
*
|
|
117
|
+
* @template T - The type to check.
|
|
118
|
+
* @template Base - The type to compare against.
|
|
119
|
+
* @template IfTrue - The branch type if condition is met. (default: `true`)
|
|
120
|
+
* @template IfFalse - The branch type if condition is not met. (default: `false`)
|
|
121
|
+
* @example
|
|
122
|
+
* ```ts
|
|
123
|
+
* type A = IfNotExtends<1, string, "valid">;
|
|
124
|
+
* // ➔ "valid"
|
|
125
|
+
* type B = IfNotExtends<1, number, "valid", "invalid">;
|
|
126
|
+
* // ➔ "invalid"
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
type IfNotExtends<T,Base,IfTrue=true,IfFalse=false>=If<NotExtends<T,Base>,IfTrue,IfFalse>;
|
|
130
|
+
/** -------------------------------------------------------
|
|
131
|
+
* * ***ExtendsArr.***
|
|
132
|
+
* -------------------------------------------------------
|
|
133
|
+
* Returns a boolean indicating whether every element of the first array argument ***extends*** the second argument.
|
|
134
|
+
*
|
|
135
|
+
* @template T - The array to check.
|
|
136
|
+
* @template Base - The type to compare each element against.
|
|
137
|
+
* @example
|
|
138
|
+
* ```ts
|
|
139
|
+
* type A = ExtendsArr<[1, 2, 3], number>;
|
|
140
|
+
* // ➔ true
|
|
141
|
+
* type B = ExtendsArr<[1, "2", 3], number>;
|
|
142
|
+
* // ➔ false
|
|
143
|
+
* ```
|
|
144
|
+
*/
|
|
145
|
+
type ExtendsArr<T extends readonly unknown[],Base>=IsEmptyArray<T>extends true?true:Pop<T,{includeRemoved:true;}>extends readonly [infer Rest extends readonly unknown[],infer Removed]?Extends<Removed,Base>extends true?ExtendsArr<Rest,Base>:false:false;export type{Extends as E,IfExtends as I,Not as N,Pop as P,NotExtends as a,ExtendsArr as b,IfNotExtends as c,PopOptions as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkZBSIGJFO_cjs=require('../chunk-ZBSIGJFO.cjs');require('../chunk-JWHM3WZQ.cjs'),require('../chunk-FDITZ5C6.cjs'),require('../chunk-N2IJPIND.cjs'),require('../chunk-2TRAPBZ7.cjs'),require('../chunk-BVPMMWDL.cjs'),require('../chunk-PUQXRLZH.cjs'),require('../chunk-U5Y2FXMN.cjs'),require('../chunk-7YWAQOA4.cjs'),require('../chunk-CN53M4QZ.cjs');Object.defineProperty(exports,"censorEmail",{enumerable:true,get:function(){return chunkZBSIGJFO_cjs.h}});Object.defineProperty(exports,"chunkString",{enumerable:true,get:function(){return chunkZBSIGJFO_cjs.i}});Object.defineProperty(exports,"formatCurrency",{enumerable:true,get:function(){return chunkZBSIGJFO_cjs.a}});Object.defineProperty(exports,"formatDateFns",{enumerable:true,get:function(){return chunkZBSIGJFO_cjs.f}});Object.defineProperty(exports,"formatDateIntl",{enumerable:true,get:function(){return chunkZBSIGJFO_cjs.e}});Object.defineProperty(exports,"formatDateTime",{enumerable:true,get:function(){return chunkZBSIGJFO_cjs.d}});Object.defineProperty(exports,"formatNumber",{enumerable:true,get:function(){return chunkZBSIGJFO_cjs.b}});Object.defineProperty(exports,"formatPhoneNumber",{enumerable:true,get:function(){return chunkZBSIGJFO_cjs.c}});Object.defineProperty(exports,"getGMTOffset",{enumerable:true,get:function(){return chunkZBSIGJFO_cjs.g}});Object.defineProperty(exports,"truncateString",{enumerable:true,get:function(){return chunkZBSIGJFO_cjs.j}});
|