@rzl-zone/utils-js 3.1.2-beta.0 → 3.2.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 +59 -32
- package/dist/NumberRangeUnion-B6bhM2s7.d.ts +33 -0
- package/dist/{any-BmdI8UbK.d.ts → any-v4TsK9ES.d.ts} +25 -26
- package/dist/{arrays-normalize-recursive-CnjYJ9xg.d.ts → arrays-normalize-recursive-BqmVuFlD.d.ts} +20 -20
- package/dist/assertions/index.cjs +1 -1
- package/dist/assertions/index.d.ts +96 -70
- package/dist/assertions/index.js +1 -1
- package/dist/chunk-2CQX5CBG.js +1 -0
- package/dist/chunk-2IOOEY45.cjs +1 -0
- package/dist/chunk-3IBQ5MOM.js +1 -0
- package/dist/chunk-3VA554KW.js +1 -0
- package/dist/chunk-5757UBXJ.cjs +1 -0
- package/dist/chunk-5IGC6PBH.js +1 -0
- package/dist/chunk-5KJFVIQT.cjs +1 -0
- package/dist/chunk-6JFCSH7J.js +1 -0
- package/dist/chunk-6JFZL7YE.cjs +1 -0
- package/dist/chunk-7ODAAXX5.cjs +1 -0
- package/dist/chunk-BAV5T2E3.cjs +1 -0
- package/dist/chunk-CAH33WOQ.cjs +1 -0
- package/dist/chunk-CKTLUNWX.js +1 -0
- package/dist/chunk-CMW2TBOQ.js +1 -0
- package/dist/chunk-D3ENH7H6.cjs +1 -0
- package/dist/chunk-DEZZUYE2.js +1 -0
- package/dist/chunk-DVMHRLKP.cjs +1 -0
- package/dist/chunk-DWF2R5GD.cjs +1 -0
- package/dist/chunk-E55EQK2U.cjs +1 -0
- package/dist/chunk-E74U6CYP.cjs +1 -0
- package/dist/chunk-EL6A35UR.cjs +1 -0
- package/dist/chunk-F6IPNNSJ.cjs +1 -0
- package/dist/chunk-FJZGG54N.cjs +1 -0
- package/dist/chunk-FWCKOJZM.js +1 -0
- package/dist/chunk-FWHNWL2P.cjs +1 -0
- package/dist/chunk-GGEADHZO.js +1 -0
- package/dist/chunk-GQR4R5WY.js +1 -0
- package/dist/chunk-H66AC7GK.cjs +1 -0
- package/dist/chunk-HQWOFR56.cjs +1 -0
- package/dist/chunk-HYRQMTRH.cjs +1 -0
- package/dist/chunk-IRFL4MAX.js +1 -0
- package/dist/chunk-IVL7CKVH.cjs +1 -0
- package/dist/chunk-IZPBKKPO.js +1 -0
- package/dist/chunk-JBQMXC5I.cjs +1 -0
- package/dist/chunk-JEQEF5WD.js +1 -0
- package/dist/chunk-JMJQCN74.js +1 -0
- package/dist/chunk-JYQTCICM.js +1 -0
- package/dist/chunk-KHO2SBNA.cjs +1 -0
- package/dist/chunk-KVAL5PAG.cjs +1 -0
- package/dist/chunk-L5RDAVVH.js +1 -0
- package/dist/chunk-LS6U7FAY.cjs +1 -0
- package/dist/chunk-NBZWMBO6.js +1 -0
- package/dist/chunk-NRF6LWBC.cjs +1 -0
- package/dist/chunk-OI5XKNZO.js +1 -0
- package/dist/chunk-ONZFBJVW.js +1 -0
- package/dist/chunk-OYTYSY7G.js +1 -0
- package/dist/chunk-PET42Z7W.js +1 -0
- package/dist/chunk-PZQ6I4JJ.cjs +1 -0
- package/dist/chunk-QBKAEVYG.js +1 -0
- package/dist/chunk-QNKGP5DY.js +1 -0
- package/dist/chunk-RIPKY4RU.js +1 -0
- package/dist/chunk-RZW35UN5.cjs +1 -0
- package/dist/chunk-SBFNXGTJ.js +1 -0
- package/dist/chunk-SBKGWRS5.js +1 -0
- package/dist/chunk-SIM77PU4.js +1 -0
- package/dist/chunk-T2T7K3KR.js +1 -0
- package/dist/chunk-T7PU2V7X.cjs +1 -0
- package/dist/chunk-UDA26MCU.cjs +1 -0
- package/dist/chunk-V45XJKHW.cjs +1 -0
- package/dist/chunk-VJDDGRIK.cjs +1 -0
- package/dist/chunk-W2WNBUDE.js +1 -0
- package/dist/chunk-WVSPXFTY.js +1 -0
- package/dist/chunk-XABCB3Y7.cjs +1 -0
- package/dist/chunk-XEDXFSGI.js +1 -0
- package/dist/chunk-YKPSRP5G.js +1 -0
- package/dist/chunk-YLA3DURS.cjs +1 -0
- package/dist/chunk-YWHHVDT4.js +1 -0
- package/dist/chunk-ZETAZZLD.cjs +1 -0
- package/dist/conversions/index.cjs +1 -1
- package/dist/conversions/index.d.ts +515 -321
- package/dist/conversions/index.js +1 -1
- package/dist/events/index.cjs +1 -1
- package/dist/events/index.d.ts +25 -20
- package/dist/events/index.js +1 -1
- package/dist/{extends-Bk_SBGdT.d.ts → extends-DtdRjDyU.d.ts} +63 -87
- package/dist/formatters/index.cjs +1 -0
- package/dist/formatters/index.d.ts +2106 -0
- package/dist/formatters/index.js +1 -0
- package/dist/generators/index.cjs +1 -0
- package/dist/{generator → generators}/index.d.ts +57 -59
- package/dist/generators/index.js +1 -0
- package/dist/{if-CvT4R7Kh.d.ts → if-ChM35c_q.d.ts} +6 -5
- package/dist/{is-array--YjXV-Wx.d.ts → is-array-BJeHxPM3.d.ts} +287 -542
- package/dist/{isPlainObject-BVhBAPHX.d.ts → isPlainObject-DGJkcFYw.d.ts} +6 -6
- package/dist/{never-BfayMBF9.d.ts → never-D89PbPh5.d.ts} +10 -19
- package/dist/next/index.cjs +1 -8
- package/dist/next/index.d.ts +15 -12
- package/dist/next/index.js +1 -8
- package/dist/next/server/index.cjs +1 -2
- package/dist/next/server/index.d.ts +1 -1
- package/dist/next/server/index.js +1 -2
- package/dist/{nils-DMz3kU7M.d.ts → nils-CO8zLHSB.d.ts} +39 -65
- package/dist/operations/index.cjs +1 -1
- package/dist/operations/index.d.ts +4 -4
- package/dist/operations/index.js +1 -1
- package/dist/or-C6qzKt2I.d.ts +82 -0
- package/dist/override-CL2olHE5.d.ts +59 -0
- package/dist/parsers/index.cjs +1 -1
- package/dist/parsers/index.js +1 -1
- package/dist/pick-BSMX6Xe2.d.ts +15 -0
- package/dist/predicates/index.cjs +1 -1
- package/dist/predicates/index.d.ts +425 -106
- package/dist/predicates/index.js +1 -1
- package/dist/prettify-3o8_Kw6b.d.ts +564 -0
- package/dist/promises/index.cjs +1 -0
- package/dist/promises/index.d.ts +107 -0
- package/dist/promises/index.js +1 -0
- package/dist/promises-LU7K00H0.d.ts +72 -0
- package/dist/rzl-utils.global.js +1 -4
- package/dist/{string-XA-til3C.d.ts → string-B1jlOnws.d.ts} +82 -121
- package/dist/strings/index.cjs +1 -1
- package/dist/strings/index.d.ts +209 -210
- package/dist/strings/index.js +1 -1
- package/dist/tailwind/index.cjs +1 -0
- package/dist/tailwind/index.d.ts +571 -0
- package/dist/tailwind/index.js +1 -0
- package/dist/types/index.d.ts +899 -1181
- package/dist/urls/index.cjs +1 -1
- package/dist/urls/index.d.ts +113 -108
- package/dist/urls/index.js +1 -1
- package/package.json +45 -47
- package/dist/NumberRangeUnion-DC-C3_Kq.d.ts +0 -26
- package/dist/chunk-26W3VZIK.cjs +0 -1
- package/dist/chunk-2KRCHXFG.cjs +0 -2
- package/dist/chunk-33ZLH266.js +0 -1
- package/dist/chunk-4L4EJTNZ.js +0 -1
- package/dist/chunk-56QBKKRE.js +0 -1
- package/dist/chunk-5Q37AP7P.js +0 -1
- package/dist/chunk-5SZUSNGZ.js +0 -1
- package/dist/chunk-7CHFAMS2.js +0 -1
- package/dist/chunk-7MMJZ6HS.js +0 -1
- package/dist/chunk-7TC6DE3J.cjs +0 -1
- package/dist/chunk-7VX33E3V.js +0 -1
- package/dist/chunk-7YWAQOA4.cjs +0 -1
- package/dist/chunk-BEZPD44N.cjs +0 -1
- package/dist/chunk-BI263OHW.js +0 -1
- package/dist/chunk-CII6WWLO.cjs +0 -1
- package/dist/chunk-D5TYPCWU.cjs +0 -1
- package/dist/chunk-EEQY5QUG.js +0 -1
- package/dist/chunk-ELDDNERR.js +0 -1
- package/dist/chunk-ESJYBIYH.js +0 -1
- package/dist/chunk-EWYPSKKM.js +0 -1
- package/dist/chunk-EXCOQLWX.cjs +0 -1
- package/dist/chunk-FIEZKTAZ.cjs +0 -1
- package/dist/chunk-FWQVTMYA.cjs +0 -1
- package/dist/chunk-G4EWCRKS.js +0 -1
- package/dist/chunk-G5LXIEFO.js +0 -0
- package/dist/chunk-G7R5XZRM.cjs +0 -1
- package/dist/chunk-GGEV7LXX.cjs +0 -1
- package/dist/chunk-HJOZOENU.cjs +0 -1
- package/dist/chunk-IRDZVLNZ.cjs +0 -1
- package/dist/chunk-IW73G523.cjs +0 -1
- package/dist/chunk-IY5OZAB3.cjs +0 -1
- package/dist/chunk-J4NCYYGS.js +0 -1
- package/dist/chunk-J7JAZAJD.js +0 -1
- package/dist/chunk-JYNSO7ZY.js +0 -1
- package/dist/chunk-K3UVKYEU.js +0 -1
- package/dist/chunk-LQ76EDZG.js +0 -1
- package/dist/chunk-MMSYCIJ2.cjs +0 -1
- package/dist/chunk-MROH35V3.cjs +0 -1
- package/dist/chunk-NJSAV73S.js +0 -1
- package/dist/chunk-NNM7QCNB.js +0 -1
- package/dist/chunk-NR44SNYE.js +0 -1
- package/dist/chunk-NXMTWY77.js +0 -1
- package/dist/chunk-OZCQZO2V.cjs +0 -4
- package/dist/chunk-PUQXRLZH.cjs +0 -1
- package/dist/chunk-Q3NTKN5I.cjs +0 -1
- package/dist/chunk-QDNSC57Z.js +0 -4
- package/dist/chunk-QGXTL5ZH.js +0 -2
- package/dist/chunk-QSQDP7L2.cjs +0 -1
- package/dist/chunk-RV2VULM7.cjs +0 -1
- package/dist/chunk-S5M33A4O.js +0 -1
- package/dist/chunk-SGTHOQQ2.js +0 -1
- package/dist/chunk-SL3RQOWA.js +0 -1
- package/dist/chunk-SW6HYEW7.cjs +0 -1
- package/dist/chunk-SYJC7UAW.js +0 -1
- package/dist/chunk-SZPWZZYG.cjs +0 -1
- package/dist/chunk-UA4B7JBO.cjs +0 -1
- package/dist/chunk-UQDJF5RR.cjs +0 -1
- package/dist/chunk-UTQUYABU.cjs +0 -1
- package/dist/chunk-VPW3DRV5.js +0 -1
- package/dist/chunk-W32WALNU.js +0 -1
- package/dist/chunk-XGZ6K753.cjs +0 -1
- package/dist/chunk-YFTR64N5.cjs +0 -1
- package/dist/chunk-ZFDS7W6B.cjs +0 -1
- package/dist/chunk-ZQOLZE6Z.cjs +0 -1
- package/dist/env/index.cjs +0 -1
- package/dist/env/index.d.ts +0 -16
- package/dist/env/index.js +0 -1
- package/dist/formatting/index.cjs +0 -1
- package/dist/formatting/index.d.ts +0 -950
- package/dist/formatting/index.js +0 -1
- package/dist/generator/index.cjs +0 -1
- package/dist/generator/index.js +0 -1
- package/dist/omit-VvmIsZmX.d.ts +0 -28
- package/dist/prettify-C4xLcYOP.d.ts +0 -353
- package/dist/promise/index.cjs +0 -1
- package/dist/promise/index.d.ts +0 -31
- package/dist/promise/index.js +0 -1
- package/dist/stylings/index.cjs +0 -1
- package/dist/stylings/index.d.ts +0 -41
- package/dist/stylings/index.js +0 -1
- package/dist/type-data-DDs-u2kq.d.ts +0 -261
package/dist/formatting/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{h as censorEmail,i as chunkString,a as formatCurrency,f as formatDateFns,e as formatDateIntl,d as formatDateTime,b as formatNumber,c as formatPhoneNumber,g as getGMTOffset,j as truncateString}from'../chunk-G4EWCRKS.js';import'../chunk-7VX33E3V.js';import'../chunk-ESJYBIYH.js';import'../chunk-NR44SNYE.js';import'../chunk-7CHFAMS2.js';import'../chunk-NJSAV73S.js';import'../chunk-ELDDNERR.js';import'../chunk-J4NCYYGS.js';import'../chunk-5SZUSNGZ.js';import'../chunk-EWYPSKKM.js';
|
package/dist/generator/index.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkSZPWZZYG_cjs=require('../chunk-SZPWZZYG.cjs'),chunkRV2VULM7_cjs=require('../chunk-RV2VULM7.cjs');require('../chunk-PUQXRLZH.cjs'),require('../chunk-26W3VZIK.cjs'),require('../chunk-7YWAQOA4.cjs'),require('../chunk-CII6WWLO.cjs');Object.defineProperty(exports,"getRandomItem",{enumerable:true,get:function(){return chunkSZPWZZYG_cjs.a}});Object.defineProperty(exports,"randomInt",{enumerable:true,get:function(){return chunkSZPWZZYG_cjs.b}});Object.defineProperty(exports,"randomIntByLength",{enumerable:true,get:function(){return chunkSZPWZZYG_cjs.c}});Object.defineProperty(exports,"randomStr",{enumerable:true,get:function(){return chunkSZPWZZYG_cjs.d}});Object.defineProperty(exports,"noop",{enumerable:true,get:function(){return chunkRV2VULM7_cjs.a}});
|
package/dist/generator/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{a as getRandomItem,b as randomInt,c as randomIntByLength,d as randomStr}from'../chunk-5Q37AP7P.js';export{a as noop}from'../chunk-SYJC7UAW.js';import'../chunk-ELDDNERR.js';import'../chunk-J4NCYYGS.js';import'../chunk-5SZUSNGZ.js';import'../chunk-EWYPSKKM.js';
|
package/dist/omit-VvmIsZmX.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import{P as Prettify}from'./prettify-C4xLcYOP.js';
|
|
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
|
-
*/
|
|
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,353 +0,0 @@
|
|
|
1
|
-
import{I as If}from'./if-CvT4R7Kh.js';import{A as AnyFunction,N as NonPlainObject}from'./type-data-DDs-u2kq.js';import{I as IsNever}from'./never-BfayMBF9.js';
|
|
2
|
-
/** -------------------------------------------------------
|
|
3
|
-
* * ***IsArrayOrTuple.***
|
|
4
|
-
* -------------------------------------------------------
|
|
5
|
-
* Checks if a given type `T` is an array or tuple type.
|
|
6
|
-
* This includes both mutable (`T[]`) and readonly (`readonly T[]`) arrays.
|
|
7
|
-
*
|
|
8
|
-
* @template T - The type to check.
|
|
9
|
-
* @example
|
|
10
|
-
* // truthy
|
|
11
|
-
* type A = IsArrayOrTuple<string[]>;
|
|
12
|
-
* // ➔ true
|
|
13
|
-
* type B = IsArrayOrTuple<readonly [string, number]>;
|
|
14
|
-
* // ➔ true
|
|
15
|
-
*
|
|
16
|
-
* // falsy
|
|
17
|
-
* type C = IsArrayOrTuple<string>; // ➔ false
|
|
18
|
-
*/
|
|
19
|
-
type IsArrayOrTuple<T>=T extends readonly any[]?true:false;
|
|
20
|
-
/** -------------------------------------------------------
|
|
21
|
-
* * ***IsConstructor.***
|
|
22
|
-
* -------------------------------------------------------
|
|
23
|
-
* Checks if a given type `T` is a constructor type (`new () => any`).
|
|
24
|
-
*
|
|
25
|
-
* @template T - The type to check.
|
|
26
|
-
* @returns `true` if `T` is a constructor, otherwise `false`.
|
|
27
|
-
* @example
|
|
28
|
-
* class MyClass {}
|
|
29
|
-
* type A = IsConstructor<typeof MyClass>;
|
|
30
|
-
* // ➔ true
|
|
31
|
-
* type B = IsConstructor<() => void>;
|
|
32
|
-
* // ➔ false
|
|
33
|
-
*/
|
|
34
|
-
type IsConstructor<T>=T extends abstract new(...args:any[])=>any?true:false;
|
|
35
|
-
/** -------------------------------------------------------
|
|
36
|
-
* * ***IsFunction.***
|
|
37
|
-
* -------------------------------------------------------
|
|
38
|
-
* Checks if a given type `T` is a callable function type.
|
|
39
|
-
*
|
|
40
|
-
* @template T - The type to check.
|
|
41
|
-
* @example
|
|
42
|
-
* type A = IsFunction<() => void>; // ➔ true
|
|
43
|
-
* type B = IsFunction<string>; // ➔ false
|
|
44
|
-
*/
|
|
45
|
-
type IsFunction<T>=T extends AnyFunction?true:false;
|
|
46
|
-
/** -------------------------------------------------------
|
|
47
|
-
* * ***Primitive.***
|
|
48
|
-
* -------------------------------------------------------
|
|
49
|
-
*
|
|
50
|
-
* Represents **all primitive types in JavaScript/TypeScript**,
|
|
51
|
-
* including their literal variants.
|
|
52
|
-
*
|
|
53
|
-
* This type matches:
|
|
54
|
-
* - Core primitive types: `string`, `number`, `boolean`, `bigint`, `symbol`, `null`, `undefined`
|
|
55
|
-
* - Literal counterparts: `"foo"`, `42`, `true`, etc.
|
|
56
|
-
*
|
|
57
|
-
* ⚠️ Note:
|
|
58
|
-
* - Unlike some definitions, this does **not** include `void` or `never`,
|
|
59
|
-
* since they are TypeScript-specific keywords, not runtime primitives.
|
|
60
|
-
*
|
|
61
|
-
* @example
|
|
62
|
-
* ```ts
|
|
63
|
-
* type A = Primitive; // any strict primitive type
|
|
64
|
-
* type B = "hello" extends Primitive ? true : false; // true
|
|
65
|
-
* type C = void extends Primitive ? true : false; // false
|
|
66
|
-
* ```
|
|
67
|
-
*/
|
|
68
|
-
type Primitive=string|number|bigint|boolean|symbol|null|undefined;
|
|
69
|
-
/** -------------------------------------------------------
|
|
70
|
-
* * ***IsPrimitive.***
|
|
71
|
-
* -------------------------------------------------------
|
|
72
|
-
*
|
|
73
|
-
* Checks if a given type `T` is a **strict primitive type** in JavaScript/TypeScript,
|
|
74
|
-
* including literal variants.
|
|
75
|
-
* This excludes `void` and `never`.
|
|
76
|
-
*
|
|
77
|
-
* Includes:
|
|
78
|
-
* - `string`, `number`, `bigint`, `boolean`, `symbol`, `null`, `undefined`.
|
|
79
|
-
* - Literal types like `"foo"`, `42`, `true`.
|
|
80
|
-
*
|
|
81
|
-
* Excludes:
|
|
82
|
-
* - `void` (absence of value)
|
|
83
|
-
* - `never` (impossible type)
|
|
84
|
-
* - `object`, `unknown`, `Date`, `arrays`, `functions`, etc.
|
|
85
|
-
*
|
|
86
|
-
* @template T - The type to check
|
|
87
|
-
*
|
|
88
|
-
* @example
|
|
89
|
-
* ```ts
|
|
90
|
-
* type A = IsPrimitive<"foo">; // true
|
|
91
|
-
* type B = IsPrimitive<null>; // true
|
|
92
|
-
* type C = IsPrimitive<number>; // true
|
|
93
|
-
* type D = IsPrimitive<undefined>; // true
|
|
94
|
-
* type E = IsPrimitive<{}>; // false
|
|
95
|
-
* type F = IsPrimitive<void>; // false
|
|
96
|
-
* type G = IsPrimitive<never>; // false
|
|
97
|
-
* type H = IsPrimitive<unknown>; // false
|
|
98
|
-
* type I = IsPrimitive<object>; // false
|
|
99
|
-
* type J = IsPrimitive<Date>; // false
|
|
100
|
-
* type K = IsPrimitive<[]>; // false
|
|
101
|
-
* type L = IsPrimitive<() => void>; // false
|
|
102
|
-
* ```
|
|
103
|
-
*/
|
|
104
|
-
type IsPrimitive<T>=IsNever<T>extends true?false:T extends Primitive?true:false;
|
|
105
|
-
/** -------------------------------------------------------
|
|
106
|
-
* * ***IsRealPrimitive.***
|
|
107
|
-
* -------------------------------------------------------
|
|
108
|
-
*
|
|
109
|
-
* Checks if a given type `T` is a **real primitive type** in JavaScript/TypeScript,
|
|
110
|
-
* based on runtime behavior, **excluding `null`** but including `undefined`.
|
|
111
|
-
*
|
|
112
|
-
* Includes:
|
|
113
|
-
* - `string`, `number`, `bigint`, `boolean`, `symbol`, `undefined`
|
|
114
|
-
* - Literal types like `"foo"`, `42`, `true`
|
|
115
|
-
*
|
|
116
|
-
* Excludes:
|
|
117
|
-
* - `null`
|
|
118
|
-
* - `never` (impossible type)
|
|
119
|
-
* - Objects, arrays, functions, `Date`, `unknown`, etc.
|
|
120
|
-
*
|
|
121
|
-
* ⚠️ Note:
|
|
122
|
-
* - This aligns with runtime `typeof` checks in JS: `typeof null === "object"`,
|
|
123
|
-
* so `null` is excluded from **“real primitives”**.
|
|
124
|
-
*
|
|
125
|
-
* @template T - The type to check.
|
|
126
|
-
*
|
|
127
|
-
* @example
|
|
128
|
-
* ```ts
|
|
129
|
-
* type A = IsRealPrimitive<42>; // true
|
|
130
|
-
* type B = IsRealPrimitive<string>; // true
|
|
131
|
-
* type C = IsRealPrimitive<boolean>; // true
|
|
132
|
-
* type D = IsRealPrimitive<undefined>; // true
|
|
133
|
-
* type E = IsRealPrimitive<{}>; // false
|
|
134
|
-
* type F = IsRealPrimitive<[]>; // false
|
|
135
|
-
* type G = IsRealPrimitive<null>; // false
|
|
136
|
-
* type H = IsRealPrimitive<Date>; // false
|
|
137
|
-
* type I = IsRealPrimitive<() => void>; // false
|
|
138
|
-
* ```
|
|
139
|
-
*/
|
|
140
|
-
type IsRealPrimitive<T>=T extends Exclude<Primitive,null>?true:false;
|
|
141
|
-
/**
|
|
142
|
-
* Applies readonly behavior according to mode.
|
|
143
|
-
*/
|
|
144
|
-
type ApplyReadonlyMode<T,Mode extends PrettifyOptions["readonlyMode"]>=Mode extends"remove"?{-readonly [K in keyof T]:T[K];}:Mode extends"preserve"?{readonly [K in keyof T]:T[K];}:{[K in keyof T]:T[K];};
|
|
145
|
-
/** -------------------------------------------------------
|
|
146
|
-
* * ***PrettifyOptions***
|
|
147
|
-
* -------------------------------------------------------
|
|
148
|
-
*
|
|
149
|
-
* Options for customizing the behavior of the {@link Prettify} type.
|
|
150
|
-
*/
|
|
151
|
-
type PrettifyOptions={
|
|
152
|
-
/** -------------------------------------------------------
|
|
153
|
-
* * ***recursive***
|
|
154
|
-
* -------------------------------------------------------
|
|
155
|
-
*
|
|
156
|
-
* Enables **deep prettification** of types when set to `true`.
|
|
157
|
-
*
|
|
158
|
-
* By default (`false`), {@link Prettify} only flattens the **top-level shape**
|
|
159
|
-
* of objects and intersections. Nested objects, arrays, and tuples remain as-is
|
|
160
|
-
* unless this option is enabled.
|
|
161
|
-
*
|
|
162
|
-
* ⚡ Behavior when `true`:
|
|
163
|
-
* - **Plain objects**: Nested intersections are expanded recursively.
|
|
164
|
-
* - **Arrays & tuples**: Each element type is recursively prettified.
|
|
165
|
-
* - **Readonly handling**: Nested properties respect the `readonlyMode` option.
|
|
166
|
-
* - **Functions, constructors, and built-in objects** (Set, Map, Date, Promise, etc.)
|
|
167
|
-
* are **not** affected or expanded.
|
|
168
|
-
* - **Nested intersections**: Combined properties are flattened recursively.
|
|
169
|
-
*
|
|
170
|
-
* ⚠️ Notes:
|
|
171
|
-
* - Recursive mode only applies to **plain objects**, **arrays**, and **tuples**.
|
|
172
|
-
* - Readonly modifiers on nested properties follow the `readonlyMode` rules:
|
|
173
|
-
* - `"auto"` → keep as-is
|
|
174
|
-
* - `"remove"` → strip readonly
|
|
175
|
-
* - `"preserve"` → make readonly
|
|
176
|
-
* - Arrays and tuples maintain `readonly` if the original type is `readonly` and `readonlyMode` is `"auto"` or `"preserve"`.
|
|
177
|
-
*
|
|
178
|
-
* @default false
|
|
179
|
-
*
|
|
180
|
-
* @example
|
|
181
|
-
* ```ts
|
|
182
|
-
* type Nested = {
|
|
183
|
-
* a: {
|
|
184
|
-
* readonly b: { c: number } & { d: string }
|
|
185
|
-
* } & { e: boolean };
|
|
186
|
-
* list: readonly ({ id: number } & { name: string })[];
|
|
187
|
-
* set: Set<{ x: number } & { y: string }>;
|
|
188
|
-
* };
|
|
189
|
-
*
|
|
190
|
-
* // Top-level only (default)
|
|
191
|
-
* type Shallow = Prettify<Nested>;
|
|
192
|
-
* // ➔ {
|
|
193
|
-
* // a: { readonly b: { c: number } & { d: string } } & { e: boolean };
|
|
194
|
-
* // list: readonly ({ id: number } & { name: string })[];
|
|
195
|
-
* // set: Set<{ x: number } & { y: string }>;
|
|
196
|
-
* // }
|
|
197
|
-
*
|
|
198
|
-
* // Fully recursive flatten
|
|
199
|
-
* type Deep = Prettify<Nested, { recursive: true }>;
|
|
200
|
-
* // ➔ {
|
|
201
|
-
* // a: { readonly b: { c: number; d: string }; e: boolean };
|
|
202
|
-
* // list: readonly { id: number; name: string }[];
|
|
203
|
-
* // set: Set<{ x: number } & { y: string }>; // built-in ignored
|
|
204
|
-
* // }
|
|
205
|
-
* ```
|
|
206
|
-
*/
|
|
207
|
-
recursive?:boolean;
|
|
208
|
-
/** -------------------------------------------------------
|
|
209
|
-
* * ***readonlyMode***
|
|
210
|
-
* -------------------------------------------------------
|
|
211
|
-
*
|
|
212
|
-
* Determines how `readonly` modifiers are applied to properties
|
|
213
|
-
* when using {@link Prettify}.
|
|
214
|
-
*
|
|
215
|
-
* Modes:
|
|
216
|
-
* - `"auto"` → Keep `readonly` exactly as in the original type (default).
|
|
217
|
-
* - `"remove"` → Remove all `readonly` modifiers.
|
|
218
|
-
* - `"preserve"` → Make all properties `readonly`.
|
|
219
|
-
*
|
|
220
|
-
* ⚡ Behavior:
|
|
221
|
-
* - Applies to both **top-level** and **nested properties** (if `recursive` is `true`).
|
|
222
|
-
* - Arrays and tuples preserve or adjust `readonly` according to the selected mode:
|
|
223
|
-
* - `"auto"` → preserve array/tuple readonly as-is.
|
|
224
|
-
* - `"remove"` → array/tuple becomes mutable.
|
|
225
|
-
* - `"preserve"` → array/tuple becomes readonly.
|
|
226
|
-
* - Functions, constructors, and built-in objects (Set, Map, Date, Promise, etc.) are **not affected**.
|
|
227
|
-
* - Nested intersections respect `readonlyMode` recursively if `recursive` is enabled.
|
|
228
|
-
*
|
|
229
|
-
* ⚠️ Notes:
|
|
230
|
-
* - For nested objects, `readonly` behavior only changes if `recursive: true`.
|
|
231
|
-
* - `readonlyMode` does **not** override `readonly` on function parameters, methods, or constructors.
|
|
232
|
-
*
|
|
233
|
-
* @default "auto"
|
|
234
|
-
*
|
|
235
|
-
* @example
|
|
236
|
-
* ```ts
|
|
237
|
-
* type T = { readonly a: number; b: string };
|
|
238
|
-
*
|
|
239
|
-
* // Default: auto
|
|
240
|
-
* type Auto = Prettify<T, { readonlyMode: "auto" }>;
|
|
241
|
-
* // ➔ { readonly a: number; b: string }
|
|
242
|
-
*
|
|
243
|
-
* // Remove readonly
|
|
244
|
-
* type Remove = Prettify<T, { readonlyMode: "remove" }>;
|
|
245
|
-
* // ➔ { a: number; b: string }
|
|
246
|
-
*
|
|
247
|
-
* // Force all readonly
|
|
248
|
-
* type Preserve = Prettify<T, { readonlyMode: "preserve" }>;
|
|
249
|
-
* // ➔ { readonly a: number; readonly b: string }
|
|
250
|
-
*
|
|
251
|
-
* // Recursive + preserve
|
|
252
|
-
* type Nested = {
|
|
253
|
-
* config: { readonly port: number } & { host: string }
|
|
254
|
-
* };
|
|
255
|
-
* type RecursivePreserve = Prettify<Nested, { recursive: true; readonlyMode: "preserve" }>;
|
|
256
|
-
* // ➔ { readonly config: { readonly port: number; readonly host: string } }
|
|
257
|
-
* ```
|
|
258
|
-
*/
|
|
259
|
-
readonlyMode?:Extract<"auto"|"remove"|"preserve",string>;};
|
|
260
|
-
/** -------------------------------------------------------
|
|
261
|
-
* * ***DefaultPrettifyOptions***
|
|
262
|
-
* -------------------------------------------------------
|
|
263
|
-
*
|
|
264
|
-
* Default options {@link Prettify} used when no custom options are provided.
|
|
265
|
-
*/
|
|
266
|
-
type DefaultPrettifyOptions={recursive:false;readonlyMode:"auto";};type MergeReadonlyIntersection<T>=T extends readonly any[]?T:T extends object?{[K in keyof T]:T[K];}:T;
|
|
267
|
-
/** -------------------------------------------------------
|
|
268
|
-
* * ***Prettify.***
|
|
269
|
-
* -------------------------------------------------------
|
|
270
|
-
* Flattens and simplifies complex TypeScript types into a more
|
|
271
|
-
* human-readable form, by forcing the compiler to expand intersections.
|
|
272
|
-
*
|
|
273
|
-
* By default, only the **top-level shape** of an object is flattened.
|
|
274
|
-
* To also prettify **nested objects**, set the `recursive` option.
|
|
275
|
-
*
|
|
276
|
-
* ⚠️ Note:
|
|
277
|
-
* - `recursive: true` only affects **plain objects** and **arrays/tuples**.
|
|
278
|
-
* - Built-in objects like `Set`, `Map`, `Date`, `Promise`, etc.
|
|
279
|
-
* will **not** be recursively prettified.
|
|
280
|
-
* - `readonly` handling is controlled via the `readonlyMode` option.
|
|
281
|
-
*
|
|
282
|
-
* ℹ️ Options:
|
|
283
|
-
* - `recursive?: boolean` (default: `false`)
|
|
284
|
-
* - Whether to recursively expand nested objects and intersections.
|
|
285
|
-
* - `readonlyMode?: "auto" | "remove" | "preserve"` (default: `"auto"`)
|
|
286
|
-
* - How `readonly` modifiers are treated:
|
|
287
|
-
* - `"auto"` → preserve `readonly` as-is (default).
|
|
288
|
-
* - `"remove"` → strip all `readonly`.
|
|
289
|
-
* - `"preserve"` → enforce `readonly` everywhere.
|
|
290
|
-
* @template T - The type to prettify.
|
|
291
|
-
* @template Options - Configuration options.
|
|
292
|
-
*
|
|
293
|
-
* @example
|
|
294
|
-
* ```ts
|
|
295
|
-
* // --- Top-level only (default) ---
|
|
296
|
-
* type T0 = Prettify<{ a: number } & { b: string }>;
|
|
297
|
-
* // ➔ { a: number; b: string }
|
|
298
|
-
*
|
|
299
|
-
* // --- Recursive expansion of nested objects ---
|
|
300
|
-
* type T1 = Prettify<
|
|
301
|
-
* { a: { x: number } & { y: string } } & { b: boolean },
|
|
302
|
-
* { recursive: true }
|
|
303
|
-
* >;
|
|
304
|
-
* // ➔ { a: { x: number; y: string }; b: boolean }
|
|
305
|
-
*
|
|
306
|
-
* // --- Readonly handling modes ---
|
|
307
|
-
* type T2 = { readonly id: number; name: string };
|
|
308
|
-
*
|
|
309
|
-
* type R1 = Prettify<T2>;
|
|
310
|
-
* // (default: readonlyMode = "auto")
|
|
311
|
-
* // ➔ { readonly id: number; name: string }
|
|
312
|
-
*
|
|
313
|
-
* type R2 = Prettify<T2, { readonlyMode: "remove" }>;
|
|
314
|
-
* // ➔ { id: number; name: string }
|
|
315
|
-
*
|
|
316
|
-
* type R3 = Prettify<T2, { readonlyMode: "preserve" }>;
|
|
317
|
-
* // ➔ { readonly id: number; readonly name: string }
|
|
318
|
-
*
|
|
319
|
-
* // --- Readonly + mutable intersection ---
|
|
320
|
-
* type T3 = Prettify<{ readonly a: number } & { a: number; b: boolean }>;
|
|
321
|
-
* // ➔ { a: number; b: boolean }
|
|
322
|
-
* // (in "auto" mode, readonly lose over mutable)
|
|
323
|
-
*
|
|
324
|
-
* // --- Nested readonly with recursive ---
|
|
325
|
-
* type T4 = Prettify<
|
|
326
|
-
* { config: { readonly port: number } & { host: string } },
|
|
327
|
-
* { recursive: true }
|
|
328
|
-
* >;
|
|
329
|
-
* // ➔ { config: { readonly port: number; host: string } }
|
|
330
|
-
*
|
|
331
|
-
* // --- Arrays with readonly ---
|
|
332
|
-
* type T5 = Prettify<
|
|
333
|
-
* { list: readonly ({ id: number } & { name: string })[] },
|
|
334
|
-
* { recursive: true }
|
|
335
|
-
* >;
|
|
336
|
-
* // (readonly on array is preserved in "auto" mode)
|
|
337
|
-
* // ➔ { list: readonly { id: number; name: string }[] }
|
|
338
|
-
*
|
|
339
|
-
* type T6 = Prettify<
|
|
340
|
-
* { list: readonly ({ id: number } & { name: string })[] },
|
|
341
|
-
* { recursive: true; readonlyMode: "remove" }
|
|
342
|
-
* >;
|
|
343
|
-
* // ➔ { list: { id: number; name: string }[] }
|
|
344
|
-
*
|
|
345
|
-
* // --- Built-in objects are ignored (not expanded) ---
|
|
346
|
-
* type T7 = Prettify<
|
|
347
|
-
* { s: Set<{ a: number } & { b: string }> },
|
|
348
|
-
* { recursive: true }
|
|
349
|
-
* >;
|
|
350
|
-
* // ➔ { s: Set<{ a: number } & { b: string }> }
|
|
351
|
-
* ```
|
|
352
|
-
*/
|
|
353
|
-
type Prettify<T,Options extends PrettifyOptions=DefaultPrettifyOptions>=IsPrimitive<T>extends true?T:IsFunction<T>extends true?T:IsConstructor<T>extends true?T:IsArrayOrTuple<T>extends true?ApplyReadonlyMode<{[K in keyof T]:If<Options["recursive"],Prettify<T[K],Options>,T[K]>;},Options["readonlyMode"]>:T extends NonPlainObject?T:T extends object?ApplyReadonlyMode<MergeReadonlyIntersection<{[K in keyof T]:If<Options["recursive"],Prettify<T[K],Options>,T[K]>;}>,Options["readonlyMode"]>:T;export type{DefaultPrettifyOptions as D,IsArrayOrTuple as I,Prettify as P,PrettifyOptions as a,IsConstructor as b,IsFunction as c,IsPrimitive as d,IsRealPrimitive as e,Primitive as f};
|
package/dist/promise/index.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkD5TYPCWU_cjs=require('../chunk-D5TYPCWU.cjs');require('../chunk-PUQXRLZH.cjs'),require('../chunk-26W3VZIK.cjs'),require('../chunk-7YWAQOA4.cjs'),require('../chunk-CII6WWLO.cjs');Object.defineProperty(exports,"delay",{enumerable:true,get:function(){return chunkD5TYPCWU_cjs.a}});
|
package/dist/promise/index.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/** ------------------------------------------------------------
|
|
2
|
-
* * ***Utility: `delay`.***
|
|
3
|
-
* ------------------------------------------------------------
|
|
4
|
-
* **Creates a Promise-based delay that resolves after a given number
|
|
5
|
-
* of milliseconds, optionally supports cancellation with `AbortSignal`.**
|
|
6
|
-
* - **Behavior:**
|
|
7
|
-
* - Validates `milliSeconds` is a non-zero, non-negative integer.
|
|
8
|
-
* - Validates `signal` is an `AbortSignal` instance when provided.
|
|
9
|
-
* - Cleans up event listeners and timers properly.
|
|
10
|
-
* @param {number} [milliSeconds=1000]
|
|
11
|
-
* The duration of the delay in milliseconds, default is `1000`.
|
|
12
|
-
* @param {AbortSignal} [signal]
|
|
13
|
-
* An optional `AbortSignal` that can cancel the delay.
|
|
14
|
-
* @returns {Promise<void>}
|
|
15
|
-
* A promise that resolves after the specified delay or
|
|
16
|
-
* rejects with an `AbortError` if aborted.
|
|
17
|
-
* @throws {TypeError} Validates `milliSeconds` and `signal`:
|
|
18
|
-
* - If `milliSeconds` **is not a valid** an `integer-number`, `NaN`, `negative-number`, or `≤ 0`.
|
|
19
|
-
* - If `signal` **is not a valid** an`AbortSignal`.
|
|
20
|
-
* @throws {DOMException}
|
|
21
|
-
* If the delay is aborted using the signal, rejects with `"AbortError"`.
|
|
22
|
-
* @example
|
|
23
|
-
* // Waits for 2 seconds
|
|
24
|
-
* await delay(2000);
|
|
25
|
-
*
|
|
26
|
-
* // Delay with AbortSignal
|
|
27
|
-
* const controller = new AbortController();
|
|
28
|
-
* delay(5000, controller.signal).catch(err => console.log(err.name)); // "AbortError"
|
|
29
|
-
* controller.abort();
|
|
30
|
-
*/
|
|
31
|
-
declare const delay:(milliSeconds?:number,signal?:AbortSignal)=>Promise<void>;export{delay};
|
package/dist/promise/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{a as delay}from'../chunk-NXMTWY77.js';import'../chunk-ELDDNERR.js';import'../chunk-J4NCYYGS.js';import'../chunk-5SZUSNGZ.js';import'../chunk-EWYPSKKM.js';
|
package/dist/stylings/index.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkYFTR64N5_cjs=require('../chunk-YFTR64N5.cjs');require('../chunk-UQDJF5RR.cjs'),require('../chunk-CII6WWLO.cjs');Object.defineProperty(exports,"shouldForwardProp",{enumerable:true,get:function(){return chunkYFTR64N5_cjs.a}});
|
package/dist/stylings/index.d.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/** Converts a union type into an intersection type.
|
|
2
|
-
*
|
|
3
|
-
* @template U - The union type to be converted.
|
|
4
|
-
*/
|
|
5
|
-
type UnionToIntersectionStrict<U>=(U extends never?never:(arg:U)=>never)extends(arg:infer I)=>void?I:never;
|
|
6
|
-
/** Converts a union type into a tuple type.
|
|
7
|
-
*
|
|
8
|
-
* @template T - The union type to be converted.
|
|
9
|
-
*/
|
|
10
|
-
type UnionToTupleStrict<T>=UnionToIntersectionStrict<T extends never?never:(t:T)=>T>extends(_:never)=>infer W?[...UnionToTupleStrict<Exclude<T,W>>,W]:[];
|
|
11
|
-
/** ----------------------------------------------------------
|
|
12
|
-
* * ***Utility: `shouldForwardProp`.***
|
|
13
|
-
* ----------------------------------------------------------
|
|
14
|
-
* **Creates a helper for styled-components `shouldForwardProp`.**
|
|
15
|
-
* @description
|
|
16
|
-
* This utility returns a predicate function that determines whether a given prop
|
|
17
|
-
* should be forwarded to the DOM, useful for filtering out internal props (e.g.,
|
|
18
|
-
* `$size`, `$active`) so they don't end up as invalid HTML attributes.
|
|
19
|
-
* - **Behavior:**
|
|
20
|
-
* - Accepts a tuple (strict) of prop keys to exclude from forwarding.
|
|
21
|
-
* - Automatically coerces prop names to string for consistent checking.
|
|
22
|
-
* - Supports string, number, or symbol keys (via PropertyKey).
|
|
23
|
-
* - Will throw an error if the provided `props` argument is not an array.
|
|
24
|
-
* @template CustomProps - The type of the component's props.
|
|
25
|
-
* @param {UnionToTupleStrict<keyof CustomProps>} props
|
|
26
|
-
* The list of prop names (keys of `CustomProps`) to exclude from forwarding.
|
|
27
|
-
* @returns {(propName: PropertyKey) => boolean}
|
|
28
|
-
* A function that takes a prop name and returns `true` if it should be forwarded, `false` if it should be blocked.
|
|
29
|
-
* @throws {TypeError} If `props` is not an array.
|
|
30
|
-
* @example
|
|
31
|
-
* type Props = { $size: string; color: string; visible: boolean };
|
|
32
|
-
* const filter = shouldForwardProp<Props>(["$size"]);
|
|
33
|
-
* filter("$size"); // ➔ false (blocked)
|
|
34
|
-
* filter("color"); // ➔ true (forwarded)
|
|
35
|
-
* @example
|
|
36
|
-
* // Using with styled-components:
|
|
37
|
-
* styled.div.withConfig({
|
|
38
|
-
* shouldForwardProp: shouldForwardProp<CustomProps>(["$internal"])
|
|
39
|
-
* })
|
|
40
|
-
*/
|
|
41
|
-
declare const shouldForwardProp:<CustomProps>(props:Partial<UnionToTupleStrict<keyof CustomProps>>)=>((propName:keyof CustomProps)=>boolean);export{shouldForwardProp};
|
package/dist/stylings/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{a as shouldForwardProp}from'../chunk-JYNSO7ZY.js';import'../chunk-SL3RQOWA.js';import'../chunk-EWYPSKKM.js';
|