@rzl-zone/utils-js 3.1.0-beta.2 → 3.1.2-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/README.md +2 -2
- 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 +396 -396
- package/dist/assertions/index.js +1 -1
- package/dist/chunk-26W3VZIK.cjs +1 -0
- package/dist/chunk-2KRCHXFG.cjs +2 -0
- package/dist/{chunk-TQMZ2LPI.js → chunk-33ZLH266.js} +1 -1
- package/dist/{chunk-VQLAPEL3.js → chunk-4L4EJTNZ.js} +1 -1
- package/dist/{chunk-CK3BZGEU.js → chunk-5Q37AP7P.js} +1 -1
- package/dist/chunk-7CHFAMS2.js +1 -0
- package/dist/{chunk-REFMEB4A.js → chunk-7MMJZ6HS.js} +1 -1
- package/dist/chunk-7TC6DE3J.cjs +1 -0
- package/dist/{chunk-K4PLGD7C.js → chunk-7VX33E3V.js} +1 -1
- package/dist/chunk-BEZPD44N.cjs +1 -0
- package/dist/{chunk-2AUUPGMN.js → chunk-BI263OHW.js} +1 -1
- package/dist/{chunk-LVUSFXQS.cjs → chunk-CII6WWLO.cjs} +1 -1
- package/dist/{chunk-OX6RLS2F.cjs → chunk-D5TYPCWU.cjs} +1 -1
- package/dist/{chunk-MWLEM7ED.js → chunk-EEQY5QUG.js} +1 -1
- package/dist/chunk-ESJYBIYH.js +1 -0
- package/dist/{chunk-MJAW5RAK.js → chunk-EWYPSKKM.js} +1 -1
- package/dist/chunk-EXCOQLWX.cjs +1 -0
- package/dist/chunk-FWQVTMYA.cjs +1 -0
- package/dist/{chunk-25G6B35W.js → chunk-G4EWCRKS.js} +1 -1
- package/dist/{chunk-PFLNHD4B.cjs → chunk-G7R5XZRM.cjs} +1 -1
- package/dist/{chunk-EXXLUO7L.cjs → chunk-GGEV7LXX.cjs} +1 -1
- package/dist/{chunk-VTR75UID.cjs → chunk-HJOZOENU.cjs} +1 -1
- package/dist/{chunk-HXTACM3O.cjs → chunk-IRDZVLNZ.cjs} +1 -1
- package/dist/chunk-IW73G523.cjs +1 -0
- package/dist/chunk-IY5OZAB3.cjs +1 -0
- package/dist/{chunk-467VEMJH.js → chunk-J4NCYYGS.js} +1 -1
- package/dist/{chunk-RHIBYOFQ.js → chunk-J7JAZAJD.js} +1 -1
- package/dist/{chunk-JQZUWBIX.js → chunk-JYNSO7ZY.js} +1 -1
- package/dist/{chunk-UUMKL74S.js → chunk-K3UVKYEU.js} +1 -1
- package/dist/{chunk-ME5OV5HN.js → chunk-LQ76EDZG.js} +1 -1
- package/dist/chunk-MROH35V3.cjs +1 -0
- package/dist/chunk-NJSAV73S.js +1 -0
- package/dist/{chunk-HXST7RJB.js → chunk-NR44SNYE.js} +1 -1
- package/dist/{chunk-BLCANGFS.js → chunk-NXMTWY77.js} +1 -1
- package/dist/chunk-OZCQZO2V.cjs +4 -0
- package/dist/chunk-Q3NTKN5I.cjs +1 -0
- package/dist/{chunk-NSVLG7NY.js → chunk-QDNSC57Z.js} +1 -1
- package/dist/{chunk-NUVGETPD.js → chunk-QGXTL5ZH.js} +1 -1
- package/dist/{chunk-D43GV6EF.cjs → chunk-QSQDP7L2.cjs} +1 -1
- package/dist/{chunk-U4TZO7WV.js → chunk-S5M33A4O.js} +1 -1
- package/dist/{chunk-S7GMG4TB.js → chunk-SGTHOQQ2.js} +1 -1
- package/dist/chunk-SL3RQOWA.js +1 -0
- package/dist/{chunk-NUHOOAUN.cjs → chunk-SZPWZZYG.cjs} +1 -1
- package/dist/{chunk-RHE3M2NJ.cjs → chunk-UA4B7JBO.cjs} +1 -1
- package/dist/chunk-UQDJF5RR.cjs +1 -0
- package/dist/chunk-UTQUYABU.cjs +1 -0
- package/dist/{chunk-G72VSVGO.js → chunk-VPW3DRV5.js} +1 -1
- package/dist/{chunk-PSWITZK5.js → chunk-W32WALNU.js} +1 -1
- package/dist/chunk-XGZ6K753.cjs +1 -0
- package/dist/chunk-YFTR64N5.cjs +1 -0
- package/dist/chunk-ZFDS7W6B.cjs +1 -0
- package/dist/chunk-ZQOLZE6Z.cjs +1 -0
- package/dist/conversions/index.cjs +1 -1
- package/dist/conversions/index.d.ts +1285 -1285
- package/dist/conversions/index.js +1 -1
- package/dist/env/index.d.ts +14 -14
- package/dist/events/index.cjs +1 -1
- package/dist/events/index.d.ts +109 -109
- package/dist/events/index.js +1 -1
- package/dist/extends-Bk_SBGdT.d.ts +330 -330
- package/dist/formatting/index.cjs +1 -1
- package/dist/formatting/index.d.ts +855 -855
- package/dist/formatting/index.js +1 -1
- package/dist/generator/index.cjs +1 -1
- package/dist/generator/index.d.ts +155 -155
- package/dist/generator/index.js +1 -1
- package/dist/if-CvT4R7Kh.d.ts +16 -16
- package/dist/is-array--YjXV-Wx.d.ts +1084 -1084
- package/dist/isPlainObject-BVhBAPHX.d.ts +154 -154
- package/dist/never-BfayMBF9.d.ts +64 -64
- package/dist/next/index.cjs +5 -5
- package/dist/next/index.d.ts +183 -183
- package/dist/next/index.js +1 -1
- package/dist/next/server/index.cjs +1 -1
- package/dist/next/server/index.d.ts +25 -25
- package/dist/next/server/index.js +1 -1
- 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 +120 -120
- package/dist/operations/index.js +1 -1
- package/dist/parsers/index.cjs +1 -1
- package/dist/parsers/index.d.ts +34 -34
- package/dist/parsers/index.js +1 -1
- package/dist/predicates/index.cjs +1 -1
- package/dist/predicates/index.d.ts +1674 -1674
- 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 -29
- package/dist/promise/index.js +1 -1
- package/dist/rzl-utils.global.js +1 -1
- package/dist/string-XA-til3C.d.ts +318 -318
- package/dist/strings/index.cjs +1 -1
- package/dist/strings/index.d.ts +690 -690
- package/dist/strings/index.js +1 -1
- package/dist/stylings/index.cjs +1 -1
- package/dist/stylings/index.d.ts +35 -35
- package/dist/stylings/index.js +1 -1
- package/dist/type-data-DDs-u2kq.d.ts +241 -241
- package/dist/types/index.d.ts +3264 -3264
- package/dist/urls/index.cjs +1 -1
- package/dist/urls/index.d.ts +373 -373
- package/dist/urls/index.js +1 -1
- package/package.json +3 -15
- package/dist/chunk-2JQQQ625.js +0 -1
- package/dist/chunk-445TAVT4.cjs +0 -1
- package/dist/chunk-6Q4I2RPC.cjs +0 -1
- package/dist/chunk-6SMJMZ7G.cjs +0 -1
- package/dist/chunk-DFSTVQFI.cjs +0 -1
- package/dist/chunk-DYRDBYPF.cjs +0 -1
- package/dist/chunk-GAJTFCUA.js +0 -1
- package/dist/chunk-GOJNH55O.cjs +0 -1
- package/dist/chunk-IJTZWWRJ.cjs +0 -1
- package/dist/chunk-ISJ33O2J.cjs +0 -1
- package/dist/chunk-JISH2VGG.js +0 -1
- package/dist/chunk-KZQB7H4E.cjs +0 -1
- package/dist/chunk-LUVV5KSD.cjs +0 -2
- package/dist/chunk-MF5Y5K4N.cjs +0 -1
- package/dist/chunk-O5VXBNUQ.cjs +0 -4
- package/dist/chunk-O7SJR4CY.cjs +0 -1
- package/dist/chunk-PYUVKHUF.cjs +0 -1
- package/dist/chunk-XFCJDSB2.cjs +0 -1
- package/dist/chunk-XOYX4PLZ.cjs +0 -1
- package/dist/chunk-Z6FLCEN6.js +0 -1
- package/dist/chunk-ZO5364A6.cjs +0 -1
- package/dist/index.cjs +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/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
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkEXCOQLWX_cjs=require('../chunk-EXCOQLWX.cjs');require('../chunk-ZFDS7W6B.cjs'),require('../chunk-G7R5XZRM.cjs'),require('../chunk-UQDJF5RR.cjs'),require('../chunk-RV2VULM7.cjs'),require('../chunk-26W3VZIK.cjs'),require('../chunk-7YWAQOA4.cjs'),require('../chunk-CII6WWLO.cjs');Object.defineProperty(exports,"findDuplicates",{enumerable:true,get:function(){return chunkEXCOQLWX_cjs.a}});Object.defineProperty(exports,"omitKeys",{enumerable:true,get:function(){return chunkEXCOQLWX_cjs.b}});Object.defineProperty(exports,"omitKeysDeep",{enumerable:true,get:function(){return chunkEXCOQLWX_cjs.c}});
|
|
@@ -1,127 +1,127 @@
|
|
|
1
1
|
import{N as NumberRangeUnion}from'../NumberRangeUnion-DC-C3_Kq.js';
|
|
2
2
|
/** ----------------------------------------------------------------------
|
|
3
|
-
* * ***Utility: `findDuplicates`.***
|
|
4
|
-
* ----------------------------------------------------------------------
|
|
5
|
-
* **Finds duplicate values in an array by deep equality comparison.**
|
|
6
|
-
* - **Behavior:**
|
|
7
|
-
* - Uses ***{@link isEqual | `isEqual`}*** to compare elements
|
|
8
|
-
* (handles objects, arrays, dates, NaN, etc.).
|
|
9
|
-
* - Returns a new array containing only the *first occurrences* of duplicated values.
|
|
10
|
-
* - Does **not mutate** the original array.
|
|
11
|
-
* - Throws ***{@link TypeError | `TypeError`}*** if input is not an array.
|
|
12
|
-
* @template T Type of elements in the input array.
|
|
13
|
-
* @param {T[]} values - The array to check for duplicates.
|
|
14
|
-
* @returns {T[]} An array of the duplicate values found in the input,
|
|
15
|
-
* preserving order of their first duplicate appearance.
|
|
16
|
-
* @throws {TypeError} If the provided `values` argument is not an array.
|
|
17
|
-
* @example
|
|
18
|
-
* findDuplicates([1, 2, 2, 3, 4, 4]);
|
|
19
|
-
* // ➔ [2, 4]
|
|
20
|
-
* findDuplicates(["apple", "banana", "apple", "orange"]);
|
|
21
|
-
* // ➔ ["apple"]
|
|
22
|
-
* findDuplicates([{ a: 1 }, { a: 1 }, { a: 2 }]);
|
|
23
|
-
* // ➔ [{ a: 1 }]
|
|
24
|
-
* findDuplicates([NaN, NaN, 1]);
|
|
25
|
-
* // ➔ [NaN]
|
|
26
|
-
* findDuplicates([true, false, true]);
|
|
27
|
-
* // ➔ [true]
|
|
28
|
-
* findDuplicates([1, 2, 3]);
|
|
29
|
-
* // ➔ []
|
|
30
|
-
*/
|
|
3
|
+
* * ***Utility: `findDuplicates`.***
|
|
4
|
+
* ----------------------------------------------------------------------
|
|
5
|
+
* **Finds duplicate values in an array by deep equality comparison.**
|
|
6
|
+
* - **Behavior:**
|
|
7
|
+
* - Uses ***{@link isEqual | `isEqual`}*** to compare elements
|
|
8
|
+
* (handles objects, arrays, dates, NaN, etc.).
|
|
9
|
+
* - Returns a new array containing only the *first occurrences* of duplicated values.
|
|
10
|
+
* - Does **not mutate** the original array.
|
|
11
|
+
* - Throws ***{@link TypeError | `TypeError`}*** if input is not an array.
|
|
12
|
+
* @template T Type of elements in the input array.
|
|
13
|
+
* @param {T[]} values - The array to check for duplicates.
|
|
14
|
+
* @returns {T[]} An array of the duplicate values found in the input,
|
|
15
|
+
* preserving order of their first duplicate appearance.
|
|
16
|
+
* @throws {TypeError} If the provided `values` argument is not an array.
|
|
17
|
+
* @example
|
|
18
|
+
* findDuplicates([1, 2, 2, 3, 4, 4]);
|
|
19
|
+
* // ➔ [2, 4]
|
|
20
|
+
* findDuplicates(["apple", "banana", "apple", "orange"]);
|
|
21
|
+
* // ➔ ["apple"]
|
|
22
|
+
* findDuplicates([{ a: 1 }, { a: 1 }, { a: 2 }]);
|
|
23
|
+
* // ➔ [{ a: 1 }]
|
|
24
|
+
* findDuplicates([NaN, NaN, 1]);
|
|
25
|
+
* // ➔ [NaN]
|
|
26
|
+
* findDuplicates([true, false, true]);
|
|
27
|
+
* // ➔ [true]
|
|
28
|
+
* findDuplicates([1, 2, 3]);
|
|
29
|
+
* // ➔ []
|
|
30
|
+
*/
|
|
31
31
|
declare const findDuplicates:<T>(values:T[])=>T[];
|
|
32
32
|
/** --------------------------------
|
|
33
|
-
* * ***Utility: `omitKeys`.***
|
|
34
|
-
* --------------------------------
|
|
35
|
-
* **This function creates a shallow copy of the given object omitting the
|
|
36
|
-
* specified keys.**
|
|
37
|
-
* - **Behavior:**
|
|
38
|
-
* - It will return a new object without mutating the original.
|
|
39
|
-
* - It also validates that ***`keysToOmit`*** does not contain duplicate keys.
|
|
40
|
-
* - **ℹ️ Internally:**
|
|
41
|
-
* - It uses ***{@link isEqual | `isEqual`}*** to check for duplicates in
|
|
42
|
-
* the ***`keysToOmit`*** array.
|
|
43
|
-
* @template I The type of the input object.
|
|
44
|
-
* @template K The keys to omit from the object.
|
|
45
|
-
* @param {I} object - The source object to omit keys from.
|
|
46
|
-
* @param {K[]} keysToOmit - An array of keys to exclude from the returned object.
|
|
47
|
-
* @returns {Omit<I, K>} A new object without the specified keys.
|
|
48
|
-
* @throws {TypeError} If `keysToOmit` is not an array.
|
|
49
|
-
* @throws {Error} If duplicate keys are found in `keysToOmit`.
|
|
50
|
-
* @example
|
|
51
|
-
* omitKeys({ a: 1, b: 2, c: 3 }, ["b", "c"]);
|
|
52
|
-
* //➔ { a: 1 }
|
|
53
|
-
* omitKeys({ name: "John", age: 30 }, ["age"]);
|
|
54
|
-
* //➔ { name: "John" }
|
|
55
|
-
* omitKeys({ a: 1, b: 2 }, []);
|
|
56
|
-
* //➔ { a: 1, b: 2 } (no changes)
|
|
57
|
-
*/
|
|
33
|
+
* * ***Utility: `omitKeys`.***
|
|
34
|
+
* --------------------------------
|
|
35
|
+
* **This function creates a shallow copy of the given object omitting the
|
|
36
|
+
* specified keys.**
|
|
37
|
+
* - **Behavior:**
|
|
38
|
+
* - It will return a new object without mutating the original.
|
|
39
|
+
* - It also validates that ***`keysToOmit`*** does not contain duplicate keys.
|
|
40
|
+
* - **ℹ️ Internally:**
|
|
41
|
+
* - It uses ***{@link isEqual | `isEqual`}*** to check for duplicates in
|
|
42
|
+
* the ***`keysToOmit`*** array.
|
|
43
|
+
* @template I The type of the input object.
|
|
44
|
+
* @template K The keys to omit from the object.
|
|
45
|
+
* @param {I} object - The source object to omit keys from.
|
|
46
|
+
* @param {K[]} keysToOmit - An array of keys to exclude from the returned object.
|
|
47
|
+
* @returns {Omit<I, K>} A new object without the specified keys.
|
|
48
|
+
* @throws {TypeError} If `keysToOmit` is not an array.
|
|
49
|
+
* @throws {Error} If duplicate keys are found in `keysToOmit`.
|
|
50
|
+
* @example
|
|
51
|
+
* omitKeys({ a: 1, b: 2, c: 3 }, ["b", "c"]);
|
|
52
|
+
* //➔ { a: 1 }
|
|
53
|
+
* omitKeys({ name: "John", age: 30 }, ["age"]);
|
|
54
|
+
* //➔ { name: "John" }
|
|
55
|
+
* omitKeys({ a: 1, b: 2 }, []);
|
|
56
|
+
* //➔ { a: 1, b: 2 } (no changes)
|
|
57
|
+
*/
|
|
58
58
|
declare const omitKeys:<I extends Record<string,unknown>,K extends keyof I>(object:I,keysToOmit:K[])=>Omit<I,K>;type IndexArray=NumberRangeUnion<0,30>;type DotPath<T,Prev extends string="">=T extends Array<infer U>?DotPath<U,`${Prev}${Prev extends "" ? "" : "."}${IndexArray}`>:T extends object?{[K in keyof T & string]:`${Prev}${Prev extends "" ? "" : "."}${K}`|DotPath<T[K],`${Prev}${Prev extends "" ? "" : "."}${K}`>;}[keyof T & string]:never;
|
|
59
59
|
/** ------------------------------------------------------
|
|
60
|
-
* * ***Utility: `omitKeysDeep`.***
|
|
61
|
-
* ------------------------------------------------------
|
|
62
|
-
* **Recursively omits properties from an object using dot notation paths.**
|
|
63
|
-
* - **Behavior:**
|
|
64
|
-
* - Also removes resulting empty objects (`{}`) and arrays (`[]`),
|
|
65
|
-
* - cascading upwards to remove empty parents until root if needed.
|
|
66
|
-
* - **⚠️ Be careful:**
|
|
67
|
-
* - If after omission an object or array becomes empty, it will be removed entirely
|
|
68
|
-
* including all the way up to the root if necessary, resulting in `{}`.
|
|
69
|
-
* - **ℹ️ Note:**
|
|
70
|
-
* - For array indices, TypeScript autocomplete only suggests `0`–`30`
|
|
71
|
-
* (to prevent editor lag on large unions).
|
|
72
|
-
* However, higher indices are still fully supported at runtime — you can
|
|
73
|
-
* manually type `"arr.99.key"` and it will work the same.
|
|
74
|
-
* @template I - Type of the input object
|
|
75
|
-
* @param {I} object
|
|
76
|
-
* The object to process. Should be a plain nested object or array structure.
|
|
77
|
-
* @param {DotPath<I>[]} keysToOmit
|
|
78
|
-
* An array of string paths in dot notation indicating the properties to remove, paths
|
|
79
|
-
* can include numeric indices to target array elements, e.g. `"arr.0.x"` to
|
|
80
|
-
* remove `x` from the first object inside the `arr` array.
|
|
81
|
-
* @returns {Partial<I>}
|
|
82
|
-
* A new deeply cloned object with the specified keys omitted, with resulting
|
|
83
|
-
* empty objects or arrays fully removed (even if it collapses to `{}`).
|
|
84
|
-
* @throws {TypeError}
|
|
85
|
-
* If `keysToOmit` is not an array will throw TypeError.
|
|
86
|
-
* @throws {Error} If `keysToOmit` contains duplicate paths will throw Error.
|
|
87
|
-
* @example
|
|
88
|
-
* omitKeysDeep({ arr: [{ a: 1 }] }, ["arr.0.a"]);
|
|
89
|
-
* // ➔ {} (array becomes empty and removed)
|
|
90
|
-
* omitKeysDeep({ a: { b: { c: 1 }, d: 2 }, e: 3 }, ["a.b.c"]);
|
|
91
|
-
* // ➔ { a: { d: 2 }, e: 3 }
|
|
92
|
-
* omitKeysDeep({ a: [{ b: 1 }, { c: 2 }] }, ["a.0.b"]);
|
|
93
|
-
* // ➔ { a: [{ c: 2 }] }
|
|
94
|
-
* omitKeysDeep({ a: [{ b: 1 }] }, ["a.0.b"]);
|
|
95
|
-
* // ➔ {} (array becomes empty and removed)
|
|
96
|
-
* omitKeysDeep({ complex: [{ deep: [{ x: 1, y: 2 }] }] }, ["complex.0.deep.0.x"]);
|
|
97
|
-
* // ➔ { complex: [{ deep: [{ y: 2 }] }] }
|
|
98
|
-
* omitKeysDeep({ complex: [{ deep: [{ x: 1 }] }] }, ["complex.0.deep.0.x"]);
|
|
99
|
-
* // ➔ {} (deep chain emptied and collapsed)
|
|
100
|
-
* omitKeysDeep({ data: [[{ foo: 1, bar: 2 }]] }, ["data.0.0.foo"]);
|
|
101
|
-
* // ➔ { data: [[{ bar: 2 }]] }
|
|
102
|
-
* omitKeysDeep({ data: [[{ foo: 1 }]] }, ["data.0.0.foo"]);
|
|
103
|
-
* // ➔ {} (nested arrays emptied completely)
|
|
104
|
-
* omitKeysDeep({ x: [{ y: [{ z: 1 }, { w: 2 }] }] }, ["x.0.y.0.z"]);
|
|
105
|
-
* // ➔ { x: [{ y: [{ w: 2 }] }] }
|
|
106
|
-
* omitKeysDeep({ x: [{ y: [{ z: 1 }] }] }, ["x.0.y.0.z"]);
|
|
107
|
-
* // ➔ {} (entire nested arrays removed)
|
|
108
|
-
* omitKeysDeep({ p: { q: { r: 5 } }, s: 6 }, ["p.q.r"]);
|
|
109
|
-
* // ➔ { s: 6 } (`p` removed because it becomes empty)
|
|
110
|
-
* omitKeysDeep({ arr: [{ a: 1, b: 2 }, { c: 3 }] }, ["arr.0.a"]);
|
|
111
|
-
* // ➔ { arr: [{ b: 2 }, { c: 3 }] }
|
|
112
|
-
* omitKeysDeep({ root: [{ sub: [{ leaf: 10 }] }] }, ["root.0.sub.0.leaf"]);
|
|
113
|
-
* // ➔ {} (deep nested arrays emptied to root)
|
|
114
|
-
* omitKeysDeep({ meta: { tags: ["x", "y"], count: 2 } }, ["meta.count"]);
|
|
115
|
-
* // ➔ { meta: { tags: ["x", "y"] } }
|
|
116
|
-
* omitKeysDeep({ arr: [[{ a: 1 }, { b: 2 }]] }, ["arr.0.0.a"]);
|
|
117
|
-
* // ➔ { arr: [[{ b: 2 }]] }
|
|
118
|
-
* omitKeysDeep({ arr: [[{ a: 1 }]] }, ["arr.0.0.a"]);
|
|
119
|
-
* // ➔ {} (double nested emptied)
|
|
120
|
-
* omitKeysDeep({ nested: [{ list: [{ id: 1, val: 2 }] }] }, ["nested.0.list.0.val"]);
|
|
121
|
-
* // ➔ { nested: [{ list: [{ id: 1 }] }] }
|
|
122
|
-
* omitKeysDeep({ nested: [{ list: [{ id: 1 }] }] }, ["nested.0.list.0.id"]);
|
|
123
|
-
* // ➔ {} (full collapse to empty)
|
|
124
|
-
* omitKeysDeep({ mixed: { a: [1, 2, 3], b: { c: 4 } } }, ["mixed.b.c"]);
|
|
125
|
-
* // ➔ { mixed: { a: [1, 2, 3] } }
|
|
126
|
-
*/
|
|
60
|
+
* * ***Utility: `omitKeysDeep`.***
|
|
61
|
+
* ------------------------------------------------------
|
|
62
|
+
* **Recursively omits properties from an object using dot notation paths.**
|
|
63
|
+
* - **Behavior:**
|
|
64
|
+
* - Also removes resulting empty objects (`{}`) and arrays (`[]`),
|
|
65
|
+
* - cascading upwards to remove empty parents until root if needed.
|
|
66
|
+
* - **⚠️ Be careful:**
|
|
67
|
+
* - If after omission an object or array becomes empty, it will be removed entirely
|
|
68
|
+
* including all the way up to the root if necessary, resulting in `{}`.
|
|
69
|
+
* - **ℹ️ Note:**
|
|
70
|
+
* - For array indices, TypeScript autocomplete only suggests `0`–`30`
|
|
71
|
+
* (to prevent editor lag on large unions).
|
|
72
|
+
* However, higher indices are still fully supported at runtime — you can
|
|
73
|
+
* manually type `"arr.99.key"` and it will work the same.
|
|
74
|
+
* @template I - Type of the input object
|
|
75
|
+
* @param {I} object
|
|
76
|
+
* The object to process. Should be a plain nested object or array structure.
|
|
77
|
+
* @param {DotPath<I>[]} keysToOmit
|
|
78
|
+
* An array of string paths in dot notation indicating the properties to remove, paths
|
|
79
|
+
* can include numeric indices to target array elements, e.g. `"arr.0.x"` to
|
|
80
|
+
* remove `x` from the first object inside the `arr` array.
|
|
81
|
+
* @returns {Partial<I>}
|
|
82
|
+
* A new deeply cloned object with the specified keys omitted, with resulting
|
|
83
|
+
* empty objects or arrays fully removed (even if it collapses to `{}`).
|
|
84
|
+
* @throws {TypeError}
|
|
85
|
+
* If `keysToOmit` is not an array will throw TypeError.
|
|
86
|
+
* @throws {Error} If `keysToOmit` contains duplicate paths will throw Error.
|
|
87
|
+
* @example
|
|
88
|
+
* omitKeysDeep({ arr: [{ a: 1 }] }, ["arr.0.a"]);
|
|
89
|
+
* // ➔ {} (array becomes empty and removed)
|
|
90
|
+
* omitKeysDeep({ a: { b: { c: 1 }, d: 2 }, e: 3 }, ["a.b.c"]);
|
|
91
|
+
* // ➔ { a: { d: 2 }, e: 3 }
|
|
92
|
+
* omitKeysDeep({ a: [{ b: 1 }, { c: 2 }] }, ["a.0.b"]);
|
|
93
|
+
* // ➔ { a: [{ c: 2 }] }
|
|
94
|
+
* omitKeysDeep({ a: [{ b: 1 }] }, ["a.0.b"]);
|
|
95
|
+
* // ➔ {} (array becomes empty and removed)
|
|
96
|
+
* omitKeysDeep({ complex: [{ deep: [{ x: 1, y: 2 }] }] }, ["complex.0.deep.0.x"]);
|
|
97
|
+
* // ➔ { complex: [{ deep: [{ y: 2 }] }] }
|
|
98
|
+
* omitKeysDeep({ complex: [{ deep: [{ x: 1 }] }] }, ["complex.0.deep.0.x"]);
|
|
99
|
+
* // ➔ {} (deep chain emptied and collapsed)
|
|
100
|
+
* omitKeysDeep({ data: [[{ foo: 1, bar: 2 }]] }, ["data.0.0.foo"]);
|
|
101
|
+
* // ➔ { data: [[{ bar: 2 }]] }
|
|
102
|
+
* omitKeysDeep({ data: [[{ foo: 1 }]] }, ["data.0.0.foo"]);
|
|
103
|
+
* // ➔ {} (nested arrays emptied completely)
|
|
104
|
+
* omitKeysDeep({ x: [{ y: [{ z: 1 }, { w: 2 }] }] }, ["x.0.y.0.z"]);
|
|
105
|
+
* // ➔ { x: [{ y: [{ w: 2 }] }] }
|
|
106
|
+
* omitKeysDeep({ x: [{ y: [{ z: 1 }] }] }, ["x.0.y.0.z"]);
|
|
107
|
+
* // ➔ {} (entire nested arrays removed)
|
|
108
|
+
* omitKeysDeep({ p: { q: { r: 5 } }, s: 6 }, ["p.q.r"]);
|
|
109
|
+
* // ➔ { s: 6 } (`p` removed because it becomes empty)
|
|
110
|
+
* omitKeysDeep({ arr: [{ a: 1, b: 2 }, { c: 3 }] }, ["arr.0.a"]);
|
|
111
|
+
* // ➔ { arr: [{ b: 2 }, { c: 3 }] }
|
|
112
|
+
* omitKeysDeep({ root: [{ sub: [{ leaf: 10 }] }] }, ["root.0.sub.0.leaf"]);
|
|
113
|
+
* // ➔ {} (deep nested arrays emptied to root)
|
|
114
|
+
* omitKeysDeep({ meta: { tags: ["x", "y"], count: 2 } }, ["meta.count"]);
|
|
115
|
+
* // ➔ { meta: { tags: ["x", "y"] } }
|
|
116
|
+
* omitKeysDeep({ arr: [[{ a: 1 }, { b: 2 }]] }, ["arr.0.0.a"]);
|
|
117
|
+
* // ➔ { arr: [[{ b: 2 }]] }
|
|
118
|
+
* omitKeysDeep({ arr: [[{ a: 1 }]] }, ["arr.0.0.a"]);
|
|
119
|
+
* // ➔ {} (double nested emptied)
|
|
120
|
+
* omitKeysDeep({ nested: [{ list: [{ id: 1, val: 2 }] }] }, ["nested.0.list.0.val"]);
|
|
121
|
+
* // ➔ { nested: [{ list: [{ id: 1 }] }] }
|
|
122
|
+
* omitKeysDeep({ nested: [{ list: [{ id: 1 }] }] }, ["nested.0.list.0.id"]);
|
|
123
|
+
* // ➔ {} (full collapse to empty)
|
|
124
|
+
* omitKeysDeep({ mixed: { a: [1, 2, 3], b: { c: 4 } } }, ["mixed.b.c"]);
|
|
125
|
+
* // ➔ { mixed: { a: [1, 2, 3] } }
|
|
126
|
+
*/
|
|
127
127
|
declare const omitKeysDeep:<I extends Record<string,unknown>>(object:I,keysToOmit:DotPath<I>[])=>Partial<I>;export{findDuplicates,omitKeys,omitKeysDeep};
|
package/dist/operations/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as findDuplicates,b as omitKeys,c as omitKeysDeep}from'../chunk-
|
|
1
|
+
export{a as findDuplicates,b as omitKeys,c as omitKeysDeep}from'../chunk-K3UVKYEU.js';import'../chunk-EEQY5QUG.js';import'../chunk-LQ76EDZG.js';import'../chunk-SL3RQOWA.js';import'../chunk-SYJC7UAW.js';import'../chunk-J4NCYYGS.js';import'../chunk-5SZUSNGZ.js';import'../chunk-EWYPSKKM.js';
|