@rzl-zone/utils-js 3.0.0-beta.0 → 3.0.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 +56 -27
- package/dist/NumberRangeUnion-DC-C3_Kq.d.ts +23 -23
- package/dist/any-BmdI8UbK.d.ts +56 -56
- package/dist/arrays-normalize-recursive-CnjYJ9xg.d.ts +66 -66
- package/dist/assertions/index.cjs +1 -1
- package/dist/assertions/index.d.ts +398 -418
- package/dist/assertions/index.js +1 -1
- package/dist/chunk-2HSNUPEO.cjs +1 -0
- package/dist/chunk-3YCFMGRB.js +1 -0
- package/dist/chunk-4Z75R3IT.cjs +1 -0
- package/dist/chunk-5C2SMIGX.cjs +1 -0
- package/dist/chunk-5Z2G23WP.js +1 -0
- package/dist/chunk-6C3ATUGM.cjs +1 -0
- package/dist/chunk-AJ25PWXX.cjs +1 -0
- package/dist/chunk-BHIBDDQF.js +1 -0
- package/dist/chunk-CE4JI2YB.js +1 -0
- package/dist/chunk-CMJ6UYWW.cjs +1 -0
- package/dist/chunk-D3VSHABU.cjs +1 -0
- package/dist/chunk-DG2GWBTS.cjs +1 -0
- package/dist/chunk-DVMHRLKP.cjs +1 -0
- package/dist/chunk-ECRNH4FW.js +1 -0
- package/dist/chunk-EKS4IZJR.cjs +1 -0
- package/dist/chunk-EOZKYR5S.cjs +1 -0
- package/dist/chunk-EUANTHVN.js +1 -0
- package/dist/chunk-EW3I4O7X.js +1 -0
- package/dist/chunk-F3E77L46.js +1 -0
- package/dist/chunk-FIAAX3UE.js +1 -0
- package/dist/chunk-FV7SEBKD.cjs +1 -0
- package/dist/chunk-GGWPB23G.cjs +1 -0
- package/dist/chunk-GVWGQNLF.js +1 -0
- package/dist/chunk-H3FXL4DU.cjs +1 -0
- package/dist/chunk-HHPDLSX2.cjs +1 -0
- package/dist/chunk-IMCLPT5V.cjs +1 -0
- package/dist/chunk-IRGE5W7L.js +1 -0
- package/dist/chunk-J2RGTPGK.cjs +1 -0
- package/dist/chunk-JARPXKBM.cjs +1 -0
- package/dist/chunk-JFJUPYDT.cjs +1 -0
- package/dist/chunk-JLP56WSM.js +1 -0
- package/dist/chunk-K3MV4AIN.cjs +1 -0
- package/dist/chunk-KHO2SBNA.cjs +1 -0
- package/dist/chunk-KOVO72OM.js +1 -0
- package/dist/chunk-LJ4M3VGE.js +1 -0
- package/dist/chunk-LJVGJLP4.js +1 -0
- package/dist/chunk-M47QIBXI.cjs +1 -0
- package/dist/chunk-MC3LXMCQ.js +1 -0
- package/dist/chunk-MISCBZJC.js +1 -0
- package/dist/chunk-MMSYCIJ2.cjs +1 -1
- package/dist/chunk-MTUBDVJ2.js +1 -0
- package/dist/chunk-O7UT5AN3.cjs +1 -0
- package/dist/chunk-OGPPP2S3.js +1 -0
- package/dist/chunk-OLPKAX7F.cjs +1 -0
- package/dist/chunk-ONZFBJVW.js +1 -0
- package/dist/chunk-ORZFHBEY.js +1 -0
- package/dist/chunk-OWV2P376.js +1 -0
- package/dist/chunk-QNKGP5DY.js +1 -0
- package/dist/chunk-RV2WK5E6.js +1 -0
- package/dist/chunk-SBF43G3B.cjs +1 -0
- package/dist/chunk-T4CIAKEK.js +1 -0
- package/dist/chunk-UDA26MCU.cjs +1 -0
- package/dist/chunk-VCFXNV3Q.cjs +1 -0
- package/dist/chunk-VHAPTHEA.cjs +1 -0
- package/dist/chunk-WVSPXFTY.js +1 -0
- package/dist/chunk-X74TUJSE.cjs +1 -0
- package/dist/chunk-XC3QHAK2.cjs +1 -0
- package/dist/chunk-XLDAIZRK.js +1 -0
- package/dist/chunk-XZJ7C4N6.js +1 -0
- package/dist/chunk-YV3K2EKJ.js +1 -0
- package/dist/chunk-ZHV5ZYVN.cjs +1 -0
- package/dist/chunk-ZL7J6GTP.js +1 -0
- package/dist/chunk-ZTCLKKMB.js +1 -0
- package/dist/conversions/index.cjs +1 -1
- package/dist/conversions/index.d.ts +1307 -1504
- package/dist/conversions/index.js +1 -1
- package/dist/env/index.cjs +1 -1
- package/dist/env/index.d.ts +14 -17
- package/dist/env/index.js +1 -1
- package/dist/events/index.cjs +1 -1
- package/dist/events/index.d.ts +111 -108
- package/dist/events/index.js +1 -1
- package/dist/extends-Bk_SBGdT.d.ts +367 -0
- package/dist/formatting/index.cjs +1 -1
- package/dist/formatting/index.d.ts +878 -840
- package/dist/formatting/index.js +1 -1
- package/dist/generator/index.cjs +1 -1
- package/dist/generator/index.d.ts +173 -150
- package/dist/generator/index.js +1 -1
- package/dist/if-CvT4R7Kh.d.ts +16 -16
- package/dist/is-array--YjXV-Wx.d.ts +1207 -0
- package/dist/isPlainObject-BVhBAPHX.d.ts +169 -0
- package/dist/never-BfayMBF9.d.ts +64 -64
- package/dist/next/index.cjs +1 -8
- package/dist/next/index.d.ts +196 -176
- package/dist/next/index.js +1 -8
- package/dist/next/server/index.cjs +1 -2
- package/dist/next/server/index.d.ts +26 -40
- package/dist/next/server/index.js +1 -2
- package/dist/nils-DMz3kU7M.d.ts +155 -155
- package/dist/omit-VvmIsZmX.d.ts +25 -25
- package/dist/operations/index.cjs +1 -1
- package/dist/operations/index.d.ts +121 -176
- package/dist/operations/index.js +1 -1
- package/dist/parsers/index.cjs +1 -1
- package/dist/parsers/index.d.ts +35 -36
- package/dist/parsers/index.js +1 -1
- package/dist/predicates/index.cjs +1 -1
- package/dist/predicates/index.d.ts +1701 -1675
- package/dist/predicates/index.js +1 -1
- package/dist/prettify-C4xLcYOP.d.ts +328 -328
- package/dist/promise/index.cjs +1 -1
- package/dist/promise/index.d.ts +29 -38
- package/dist/promise/index.js +1 -1
- package/dist/rzl-utils.global.js +1 -4
- package/dist/string-XA-til3C.d.ts +351 -0
- package/dist/strings/index.cjs +1 -1
- package/dist/strings/index.d.ts +712 -787
- package/dist/strings/index.js +1 -1
- package/dist/tailwind/index.cjs +1 -0
- package/dist/tailwind/index.d.ts +565 -0
- package/dist/tailwind/index.js +1 -0
- package/dist/type-data-DDs-u2kq.d.ts +241 -241
- package/dist/types/index.d.ts +3266 -3266
- package/dist/urls/index.cjs +1 -1
- package/dist/urls/index.d.ts +384 -409
- package/dist/urls/index.js +1 -1
- package/package.json +61 -18
- package/dist/array-CIZRbqTF.d.ts +0 -223
- package/dist/chunk-2TRAPBZ7.cjs +0 -1
- package/dist/chunk-3D74QO5D.cjs +0 -1
- package/dist/chunk-4DK3RCC4.js +0 -2
- package/dist/chunk-4JOQ45HL.js +0 -1
- package/dist/chunk-55CZALRS.js +0 -1
- package/dist/chunk-56QBKKRE.js +0 -1
- package/dist/chunk-5JFV3GDE.cjs +0 -4
- package/dist/chunk-5SZUSNGZ.js +0 -1
- package/dist/chunk-62HX5Z45.cjs +0 -1
- package/dist/chunk-7NA6DUHR.cjs +0 -2
- package/dist/chunk-7YWAQOA4.cjs +0 -1
- package/dist/chunk-BVPMMWDL.cjs +0 -1
- package/dist/chunk-BYZAD3XN.cjs +0 -1
- package/dist/chunk-CEFYHEM4.cjs +0 -1
- package/dist/chunk-CN53M4QZ.cjs +0 -1
- package/dist/chunk-D47MHBSD.cjs +0 -1
- package/dist/chunk-DGH75GJD.js +0 -1
- package/dist/chunk-E5NUI7PN.js +0 -1
- package/dist/chunk-ELDDNERR.js +0 -1
- package/dist/chunk-EXZ47NOW.js +0 -1
- package/dist/chunk-FDITZ5C6.cjs +0 -1
- package/dist/chunk-FF76ISQ2.js +0 -1
- package/dist/chunk-FIEZKTAZ.cjs +0 -1
- package/dist/chunk-FSSV24W7.cjs +0 -1
- package/dist/chunk-GCGU2WB7.js +0 -1
- package/dist/chunk-GECI2YBP.js +0 -1
- package/dist/chunk-GQE4OVHC.cjs +0 -1
- package/dist/chunk-GRVZXQXL.cjs +0 -1
- package/dist/chunk-I4AVNHPA.cjs +0 -1
- package/dist/chunk-JFRL7NKU.js +0 -4
- package/dist/chunk-JWHM3WZQ.cjs +0 -1
- package/dist/chunk-KCQDDZJE.cjs +0 -1
- package/dist/chunk-L54ZPSYJ.js +0 -1
- package/dist/chunk-LVKAYEZ4.js +0 -1
- package/dist/chunk-MBDWTK54.cjs +0 -1
- package/dist/chunk-MNGGDB2G.js +0 -1
- package/dist/chunk-MY7BA4GI.cjs +0 -1
- package/dist/chunk-N2IJPIND.cjs +0 -1
- package/dist/chunk-NIMNTEGV.js +0 -1
- package/dist/chunk-NNM7QCNB.js +0 -1
- package/dist/chunk-PUQXRLZH.cjs +0 -1
- package/dist/chunk-PVJF2JHM.js +0 -1
- package/dist/chunk-QCFXEUKL.js +0 -1
- package/dist/chunk-QFCGBBSY.js +0 -1
- package/dist/chunk-QQYAUPSK.cjs +0 -1
- package/dist/chunk-RN3TP3S3.js +0 -1
- package/dist/chunk-RV2VULM7.cjs +0 -1
- package/dist/chunk-SW6HYEW7.cjs +0 -1
- package/dist/chunk-SYJC7UAW.js +0 -1
- package/dist/chunk-TC4VBE4Y.cjs +0 -1
- package/dist/chunk-TUXDINHF.cjs +0 -1
- package/dist/chunk-U5Y2FXMN.cjs +0 -1
- package/dist/chunk-UUPQI6ND.cjs +0 -1
- package/dist/chunk-VYCGZ2S6.js +0 -1
- package/dist/chunk-W5EDKJK3.js +0 -1
- package/dist/chunk-WHAVUFEU.js +0 -1
- package/dist/chunk-XCFIOTCV.js +0 -1
- package/dist/chunk-XE27XPJR.js +0 -1
- package/dist/chunk-XH6MCRLP.js +0 -1
- package/dist/chunk-XVB3ZZEB.js +0 -1
- package/dist/chunk-ZBSIGJFO.cjs +0 -1
- package/dist/chunk-ZYAML74V.js +0 -1
- package/dist/extends-Mp81Hq9-.d.ts +0 -145
- package/dist/index.cjs +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/is-array-Ckm_47hw.d.ts +0 -1557
- package/dist/isPlainObject-BKYaI6a8.d.ts +0 -182
- package/dist/stylings/index.cjs +0 -1
- package/dist/stylings/index.d.ts +0 -49
- package/dist/stylings/index.js +0 -1
package/dist/nils-DMz3kU7M.d.ts
CHANGED
|
@@ -1,177 +1,177 @@
|
|
|
1
1
|
/** --------------------------------------------------
|
|
2
|
-
* * ***Nullish.***
|
|
3
|
-
* --------------------------------------------------
|
|
4
|
-
* Represents all values considered **"nullish"**:
|
|
5
|
-
* - `null`
|
|
6
|
-
* - `undefined`
|
|
7
|
-
*
|
|
8
|
-
* Useful as a shorthand when working with optional or missing values.
|
|
9
|
-
*/
|
|
2
|
+
* * ***Nullish.***
|
|
3
|
+
* --------------------------------------------------
|
|
4
|
+
* Represents all values considered **"nullish"**:
|
|
5
|
+
* - `null`
|
|
6
|
+
* - `undefined`
|
|
7
|
+
*
|
|
8
|
+
* Useful as a shorthand when working with optional or missing values.
|
|
9
|
+
*/
|
|
10
10
|
type Nullish=null|undefined;
|
|
11
11
|
/** --------------------------------------------------
|
|
12
|
-
* * ***Nullable.***
|
|
13
|
-
* --------------------------------------------------
|
|
14
|
-
* Represents a type that can be either `T` or `null`.
|
|
15
|
-
*
|
|
16
|
-
* @template T - The base type.
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ```ts
|
|
20
|
-
* type A = Nullable<string>; // ➔ string | null
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
12
|
+
* * ***Nullable.***
|
|
13
|
+
* --------------------------------------------------
|
|
14
|
+
* Represents a type that can be either `T` or `null`.
|
|
15
|
+
*
|
|
16
|
+
* @template T - The base type.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* type A = Nullable<string>; // ➔ string | null
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
23
|
type Nullable<T>=T|null;
|
|
24
24
|
/** --------------------------------------------------
|
|
25
|
-
* * ***Nilable.***
|
|
26
|
-
* --------------------------------------------------
|
|
27
|
-
* Represents a type that can be either `T`, `null`, or `undefined`.
|
|
28
|
-
*
|
|
29
|
-
* @template T - The base type.
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* ```ts
|
|
33
|
-
* type A = Nilable<number>; // ➔ number | null | undefined
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
25
|
+
* * ***Nilable.***
|
|
26
|
+
* --------------------------------------------------
|
|
27
|
+
* Represents a type that can be either `T`, `null`, or `undefined`.
|
|
28
|
+
*
|
|
29
|
+
* @template T - The base type.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* type A = Nilable<number>; // ➔ number | null | undefined
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
36
|
type Nilable<T>=T|null|undefined;
|
|
37
37
|
/** --------------------------------------------------
|
|
38
|
-
* * ***Undefinedable.***
|
|
39
|
-
* --------------------------------------------------
|
|
40
|
-
* Represents a type that can be either `T` or `undefined`.
|
|
41
|
-
*
|
|
42
|
-
* @template T - The base type.
|
|
43
|
-
*
|
|
44
|
-
* @example
|
|
45
|
-
* ```ts
|
|
46
|
-
* type A = Undefinedable<boolean>; // ➔ boolean | undefined
|
|
47
|
-
* ```
|
|
48
|
-
*/
|
|
38
|
+
* * ***Undefinedable.***
|
|
39
|
+
* --------------------------------------------------
|
|
40
|
+
* Represents a type that can be either `T` or `undefined`.
|
|
41
|
+
*
|
|
42
|
+
* @template T - The base type.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```ts
|
|
46
|
+
* type A = Undefinedable<boolean>; // ➔ boolean | undefined
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
49
|
type Undefinedable<T>=T|undefined;
|
|
50
50
|
/** -------------------------------------------------------
|
|
51
|
-
* * ***NonNil.***
|
|
52
|
-
* -------------------------------------------------------
|
|
53
|
-
* Removes both `null` and `undefined` from the given type `T`.
|
|
54
|
-
*
|
|
55
|
-
* @template T - The type to filter.
|
|
56
|
-
*
|
|
57
|
-
* @example
|
|
58
|
-
* ```ts
|
|
59
|
-
* type A = NonNil<string | null | undefined>;
|
|
60
|
-
* // ➔ string
|
|
61
|
-
*
|
|
62
|
-
* type B = NonNil<number | null>;
|
|
63
|
-
* // ➔ number
|
|
64
|
-
*
|
|
65
|
-
* type C = NonNil<undefined | null>;
|
|
66
|
-
* // ➔ never
|
|
67
|
-
*
|
|
68
|
-
* type D = NonNil<boolean | undefined>;
|
|
69
|
-
* // ➔ boolean
|
|
70
|
-
* ```
|
|
71
|
-
*/
|
|
51
|
+
* * ***NonNil.***
|
|
52
|
+
* -------------------------------------------------------
|
|
53
|
+
* Removes both `null` and `undefined` from the given type `T`.
|
|
54
|
+
*
|
|
55
|
+
* @template T - The type to filter.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```ts
|
|
59
|
+
* type A = NonNil<string | null | undefined>;
|
|
60
|
+
* // ➔ string
|
|
61
|
+
*
|
|
62
|
+
* type B = NonNil<number | null>;
|
|
63
|
+
* // ➔ number
|
|
64
|
+
*
|
|
65
|
+
* type C = NonNil<undefined | null>;
|
|
66
|
+
* // ➔ never
|
|
67
|
+
*
|
|
68
|
+
* type D = NonNil<boolean | undefined>;
|
|
69
|
+
* // ➔ boolean
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
72
|
type NonNil<T>=T extends null|undefined?never:T;
|
|
73
73
|
/** -------------------------------------------------------
|
|
74
|
-
* * ***NonNull.***
|
|
75
|
-
* -------------------------------------------------------
|
|
76
|
-
* Removes `null` from the given type `T`.
|
|
77
|
-
*
|
|
78
|
-
* @template T - The type to filter.
|
|
79
|
-
*
|
|
80
|
-
* @example
|
|
81
|
-
* ```ts
|
|
82
|
-
* type A = NonNull<string | null>;
|
|
83
|
-
* // ➔ string
|
|
84
|
-
*
|
|
85
|
-
* type B = NonNull<number | null | undefined>;
|
|
86
|
-
* // ➔ number | undefined
|
|
87
|
-
*
|
|
88
|
-
* type C = NonNull<null>;
|
|
89
|
-
* // ➔ never
|
|
90
|
-
* ```
|
|
91
|
-
*/
|
|
74
|
+
* * ***NonNull.***
|
|
75
|
+
* -------------------------------------------------------
|
|
76
|
+
* Removes `null` from the given type `T`.
|
|
77
|
+
*
|
|
78
|
+
* @template T - The type to filter.
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```ts
|
|
82
|
+
* type A = NonNull<string | null>;
|
|
83
|
+
* // ➔ string
|
|
84
|
+
*
|
|
85
|
+
* type B = NonNull<number | null | undefined>;
|
|
86
|
+
* // ➔ number | undefined
|
|
87
|
+
*
|
|
88
|
+
* type C = NonNull<null>;
|
|
89
|
+
* // ➔ never
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
92
|
type NonNull<T>=T extends null?never:T;
|
|
93
93
|
/** -------------------------------------------------------
|
|
94
|
-
* * ***NonUndefined.***
|
|
95
|
-
* -------------------------------------------------------
|
|
96
|
-
* Remove `undefined` from the given type `T`.
|
|
97
|
-
*
|
|
98
|
-
* @template T - The type to filter.
|
|
99
|
-
*
|
|
100
|
-
* @example
|
|
101
|
-
* ```ts
|
|
102
|
-
* type A = NonUndefined<string | undefined>;
|
|
103
|
-
* // ➔ string
|
|
104
|
-
*
|
|
105
|
-
* type B = NonUndefined<number | null | undefined>;
|
|
106
|
-
* // ➔ number | null
|
|
107
|
-
*
|
|
108
|
-
* type C = NonUndefined<undefined>;
|
|
109
|
-
* // ➔ never
|
|
110
|
-
* ```
|
|
111
|
-
*/
|
|
94
|
+
* * ***NonUndefined.***
|
|
95
|
+
* -------------------------------------------------------
|
|
96
|
+
* Remove `undefined` from the given type `T`.
|
|
97
|
+
*
|
|
98
|
+
* @template T - The type to filter.
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```ts
|
|
102
|
+
* type A = NonUndefined<string | undefined>;
|
|
103
|
+
* // ➔ string
|
|
104
|
+
*
|
|
105
|
+
* type B = NonUndefined<number | null | undefined>;
|
|
106
|
+
* // ➔ number | null
|
|
107
|
+
*
|
|
108
|
+
* type C = NonUndefined<undefined>;
|
|
109
|
+
* // ➔ never
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
112
|
type NonUndefined<T>=T extends undefined?never:T;
|
|
113
113
|
/** --------------------------------------------------
|
|
114
|
-
* * ***KeepNil.***
|
|
115
|
-
* --------------------------------------------------
|
|
116
|
-
*
|
|
117
|
-
* Keeps `null` and/or `undefined` in the output type
|
|
118
|
-
* **only if** they exist in the input type `T`.
|
|
119
|
-
* Otherwise, resolves to `never`.
|
|
120
|
-
*
|
|
121
|
-
* @template T - Input type to check for `null` and `undefined`.
|
|
122
|
-
*
|
|
123
|
-
* @example
|
|
124
|
-
* ```ts
|
|
125
|
-
* type A = KeepNil<string | null>; // ➔ null
|
|
126
|
-
* type B = KeepNil<number | undefined>; // ➔ undefined
|
|
127
|
-
* type C = KeepNil<string | null | undefined>; // ➔ null | undefined
|
|
128
|
-
* type D = KeepNil<boolean>; // ➔ never
|
|
129
|
-
* ```
|
|
130
|
-
*/
|
|
114
|
+
* * ***KeepNil.***
|
|
115
|
+
* --------------------------------------------------
|
|
116
|
+
*
|
|
117
|
+
* Keeps `null` and/or `undefined` in the output type
|
|
118
|
+
* **only if** they exist in the input type `T`.
|
|
119
|
+
* Otherwise, resolves to `never`.
|
|
120
|
+
*
|
|
121
|
+
* @template T - Input type to check for `null` and `undefined`.
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* ```ts
|
|
125
|
+
* type A = KeepNil<string | null>; // ➔ null
|
|
126
|
+
* type B = KeepNil<number | undefined>; // ➔ undefined
|
|
127
|
+
* type C = KeepNil<string | null | undefined>; // ➔ null | undefined
|
|
128
|
+
* type D = KeepNil<boolean>; // ➔ never
|
|
129
|
+
* ```
|
|
130
|
+
*/
|
|
131
131
|
type KeepNil<T>=(null extends T?null:never)|(undefined extends T?undefined:never);
|
|
132
132
|
/** --------------------------------------------------
|
|
133
|
-
* * ***KeepNull.***
|
|
134
|
-
* --------------------------------------------------
|
|
135
|
-
* Keeps `null` in the output type **only if** the input type `T` includes `null`.
|
|
136
|
-
* Otherwise resolves to `never`.
|
|
137
|
-
*
|
|
138
|
-
* @template T - Input type to check for `null`.
|
|
139
|
-
*
|
|
140
|
-
* @example
|
|
141
|
-
* ```ts
|
|
142
|
-
* type A = KeepNull<string | null>; // ➔ null
|
|
143
|
-
* type B = KeepNull<string>; // ➔ never
|
|
144
|
-
* ```
|
|
145
|
-
*/
|
|
133
|
+
* * ***KeepNull.***
|
|
134
|
+
* --------------------------------------------------
|
|
135
|
+
* Keeps `null` in the output type **only if** the input type `T` includes `null`.
|
|
136
|
+
* Otherwise resolves to `never`.
|
|
137
|
+
*
|
|
138
|
+
* @template T - Input type to check for `null`.
|
|
139
|
+
*
|
|
140
|
+
* @example
|
|
141
|
+
* ```ts
|
|
142
|
+
* type A = KeepNull<string | null>; // ➔ null
|
|
143
|
+
* type B = KeepNull<string>; // ➔ never
|
|
144
|
+
* ```
|
|
145
|
+
*/
|
|
146
146
|
type KeepNull<T>=null extends T?null:never;
|
|
147
147
|
/** --------------------------------------------------
|
|
148
|
-
* * ***KeepUndef.***
|
|
149
|
-
* --------------------------------------------------
|
|
150
|
-
* Keeps `undefined` in the output type **only if** the input type `T` includes `undefined`.
|
|
151
|
-
* Otherwise resolves to `never`.
|
|
152
|
-
*
|
|
153
|
-
* @template T - Input type to check for `undefined`.
|
|
154
|
-
*
|
|
155
|
-
* @example
|
|
156
|
-
* ```ts
|
|
157
|
-
* type A = KeepUndef<number | undefined>; // ➔ undefined
|
|
158
|
-
* type B = KeepUndef<number>; // ➔ never
|
|
159
|
-
* ```
|
|
160
|
-
*/
|
|
148
|
+
* * ***KeepUndef.***
|
|
149
|
+
* --------------------------------------------------
|
|
150
|
+
* Keeps `undefined` in the output type **only if** the input type `T` includes `undefined`.
|
|
151
|
+
* Otherwise resolves to `never`.
|
|
152
|
+
*
|
|
153
|
+
* @template T - Input type to check for `undefined`.
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* ```ts
|
|
157
|
+
* type A = KeepUndef<number | undefined>; // ➔ undefined
|
|
158
|
+
* type B = KeepUndef<number>; // ➔ never
|
|
159
|
+
* ```
|
|
160
|
+
*/
|
|
161
161
|
type KeepUndef<T>=undefined extends T?undefined:never;
|
|
162
162
|
/** -------------------------------------------------------
|
|
163
|
-
* * ***NullToUndefined.***
|
|
164
|
-
* -------------------------------------------------------
|
|
165
|
-
* Transforms `null` or `undefined` types into `undefined`, otherwise, returns the original type `T` unchanged.
|
|
166
|
-
*
|
|
167
|
-
* @template T - The input type to transform.
|
|
168
|
-
* @example
|
|
169
|
-
* ```ts
|
|
170
|
-
* type A = NullToUndefined<null>; // ➔ undefined
|
|
171
|
-
* type B = NullToUndefined<undefined>; // ➔ undefined
|
|
172
|
-
* type C = NullToUndefined<string>; // ➔ string
|
|
173
|
-
* type D = NullToUndefined<null[]>; // ➔ null[]
|
|
174
|
-
* type E = NullToUndefined<(string | null)[]>; // ➔ (string | null)[]
|
|
175
|
-
* ```
|
|
176
|
-
*/
|
|
163
|
+
* * ***NullToUndefined.***
|
|
164
|
+
* -------------------------------------------------------
|
|
165
|
+
* Transforms `null` or `undefined` types into `undefined`, otherwise, returns the original type `T` unchanged.
|
|
166
|
+
*
|
|
167
|
+
* @template T - The input type to transform.
|
|
168
|
+
* @example
|
|
169
|
+
* ```ts
|
|
170
|
+
* type A = NullToUndefined<null>; // ➔ undefined
|
|
171
|
+
* type B = NullToUndefined<undefined>; // ➔ undefined
|
|
172
|
+
* type C = NullToUndefined<string>; // ➔ string
|
|
173
|
+
* type D = NullToUndefined<null[]>; // ➔ null[]
|
|
174
|
+
* type E = NullToUndefined<(string | null)[]>; // ➔ (string | null)[]
|
|
175
|
+
* ```
|
|
176
|
+
*/
|
|
177
177
|
type NullToUndefined<T>=T extends null?undefined:T extends undefined?undefined:T;export type{KeepNil as K,NonUndefined as N,Undefinedable as U,KeepNull as a,KeepUndef as b,Nilable as c,NonNil as d,NonNull as e,Nullable as f,NullToUndefined as g,Nullish as h};
|
package/dist/omit-VvmIsZmX.d.ts
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import{P as Prettify}from'./prettify-C4xLcYOP.js';
|
|
2
2
|
/** --------------------------------------------------
|
|
3
|
-
* * ***OmitStrict.***
|
|
4
|
-
* --------------------------------------------------
|
|
5
|
-
* Strictly omits keys `K` from type `T`, with optional flattening for readability using `Prettify`.
|
|
6
|
-
*
|
|
7
|
-
* ✅ Enhances autocomplete and type inspection clarity in editors.
|
|
8
|
-
* ✅ Optionally flattens nested intersections or mapped types into a cleaner shape.
|
|
9
|
-
*
|
|
10
|
-
* @template T - The original object type.
|
|
11
|
-
* @template K - The keys to omit from `T`.
|
|
12
|
-
* @template WithPrettify - Whether to prettify the result (default is `true`).
|
|
13
|
-
* @template WithPrettifyRecursive - Whether to prettify nested object properties recursively (default is `true`).
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```ts
|
|
17
|
-
* type A = { a: number; b: string; c: boolean };
|
|
18
|
-
* type B = OmitStrict<A, 'b'>;
|
|
19
|
-
* // ➔ { a: number; c: boolean }
|
|
20
|
-
*
|
|
21
|
-
* type C = OmitStrict<A, 'b', false>;
|
|
22
|
-
* // ➔ Omit without prettifying, keeps intersection structure
|
|
23
|
-
*
|
|
24
|
-
* type D = OmitStrict<A, 'b', true, false>;
|
|
25
|
-
* // ➔ Prettifies only top level, does not recurse into nested objects
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
3
|
+
* * ***OmitStrict.***
|
|
4
|
+
* --------------------------------------------------
|
|
5
|
+
* Strictly omits keys `K` from type `T`, with optional flattening for readability using `Prettify`.
|
|
6
|
+
*
|
|
7
|
+
* ✅ Enhances autocomplete and type inspection clarity in editors.
|
|
8
|
+
* ✅ Optionally flattens nested intersections or mapped types into a cleaner shape.
|
|
9
|
+
*
|
|
10
|
+
* @template T - The original object type.
|
|
11
|
+
* @template K - The keys to omit from `T`.
|
|
12
|
+
* @template WithPrettify - Whether to prettify the result (default is `true`).
|
|
13
|
+
* @template WithPrettifyRecursive - Whether to prettify nested object properties recursively (default is `true`).
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* type A = { a: number; b: string; c: boolean };
|
|
18
|
+
* type B = OmitStrict<A, 'b'>;
|
|
19
|
+
* // ➔ { a: number; c: boolean }
|
|
20
|
+
*
|
|
21
|
+
* type C = OmitStrict<A, 'b', false>;
|
|
22
|
+
* // ➔ Omit without prettifying, keeps intersection structure
|
|
23
|
+
*
|
|
24
|
+
* type D = OmitStrict<A, 'b', true, false>;
|
|
25
|
+
* // ➔ Prettifies only top level, does not recurse into nested objects
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
28
|
type OmitStrict<T,K extends keyof T,WithPrettify extends boolean=true,WithPrettifyRecursive extends boolean=true>=WithPrettify extends true?Prettify<Omit<T,K>,{recursive:WithPrettifyRecursive;}>:WithPrettify extends false?Omit<T,K>:never;export type{OmitStrict as O};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";var e=require("../chunk-EKS4IZJR.cjs");require("../chunk-EOZKYR5S.cjs"),require("../chunk-JARPXKBM.cjs"),require("../chunk-VHAPTHEA.cjs"),require("../chunk-5C2SMIGX.cjs"),require("../chunk-ZHV5ZYVN.cjs"),require("../chunk-UDA26MCU.cjs"),require("../chunk-D3VSHABU.cjs"),Object.defineProperty(exports,"findDuplicates",{enumerable:!0,get:function(){return e.findDuplicates}}),Object.defineProperty(exports,"omitKeys",{enumerable:!0,get:function(){return e.omitKeys}}),Object.defineProperty(exports,"omitKeysDeep",{enumerable:!0,get:function(){return e.omitKeysDeep}});
|