@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/README.md
CHANGED
|
@@ -3,21 +3,37 @@
|
|
|
3
3
|
</div>
|
|
4
4
|
|
|
5
5
|
<p align="center">
|
|
6
|
-
🚀 <strong>Rzl Utility
|
|
6
|
+
🚀 <strong>Rzl Utility JS</strong> 🚀<br/>
|
|
7
7
|
A lightweight, modern TypeScript utility library for Node.js & browser (via bundlers like Webpack/Vite).<br/>
|
|
8
|
-
Provides reusable helpers to simplify your JavaScript
|
|
9
|
-
<strong>Built with ❤️ by <a href="https://github.com/rzl-app">@rzl-app</a>.</strong>
|
|
8
|
+
Provides reusable helpers to simplify your JavaScript or TypeScript projects.<br/>
|
|
9
|
+
<strong>Built with ❤️ by <a href="https://github.com/rzl-app" target="_blank" rel="nofollow noreferrer noopener">@rzl-app</a>.</strong>
|
|
10
10
|
</p>
|
|
11
11
|
|
|
12
12
|
<div align="center">
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
<p>
|
|
15
|
+
<a href="https://npmjs.com/package/@rzl-zone/utils-js" target="_blank" rel="nofollow noreferrer noopener">
|
|
16
|
+
<img src="https://img.shields.io/npm/v/@rzl-zone/utils-js?color=blue&style=flat-rounded" alt="Latest Version on NPM" data-canonical-src="https://img.shields.io/npm/v/@rzl-zone/utils-js?color=blue&style=flat-rounded">
|
|
17
|
+
</a>
|
|
18
|
+
<a href="https://npmjs.com/package/@rzl-zone/utils-js" target="_blank" rel="nofollow noreferrer noopener">
|
|
19
|
+
<img src="https://img.shields.io/npm/dt/@rzl-zone/utils-js?style=flat-rounded" alt="Downloads">
|
|
20
|
+
</a>
|
|
21
|
+
<a href="https://nodejs.org/en/" target="_blank" rel="nofollow noreferrer noopener">
|
|
22
|
+
<img src="https://img.shields.io/badge/node-≥16.0.0-blue.svg?logo=node.js&style=flat-rounded" alt="Node.js">
|
|
23
|
+
</a>
|
|
24
|
+
<a href="https://github.com/rzl-zone/utils-js/blob/main/CONTRIBUTING.md" target="_blank" rel="nofollow noreferrer noopener">
|
|
25
|
+
<img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" alt="PRs Welcome">
|
|
26
|
+
</a>
|
|
27
|
+
<a href="https://github.com/rzl-zone/utils-js/blob/main/LICENSE.md" target="_blank" rel="nofollow noreferrer noopener">
|
|
28
|
+
<img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="GitHub license">
|
|
29
|
+
</a>
|
|
30
|
+
<a href="https://github.com/rzl-zone/utils-js" target="_blank" rel="nofollow noreferrer noopener">
|
|
31
|
+
<img src="https://img.shields.io/badge/GitHub-rzl--zone%2Futils--js-181717?logo=github" alt="GitHub">
|
|
32
|
+
</a>
|
|
33
|
+
<a href="https://github.com/rzl-app" target="_blank" rel="nofollow noreferrer noopener">
|
|
34
|
+
<img src="https://img.shields.io/badge/Repo-on%20GitHub-181717?logo=github&style=flat-rounded" alt="Repo on GitHub">
|
|
35
|
+
</a>
|
|
36
|
+
</p>
|
|
21
37
|
|
|
22
38
|
</div>
|
|
23
39
|
|
|
@@ -34,7 +50,7 @@ Provides reusable helpers to simplify your JavaScript / TypeScript projects.<br/
|
|
|
34
50
|
- ❤️ [Sponsor](#sponsor-this-package)
|
|
35
51
|
- 📜 [Changelog](#changelog)
|
|
36
52
|
- 🤝 [Contributing](#contributing)
|
|
37
|
-
-
|
|
53
|
+
- 🔒 [Security](#security)
|
|
38
54
|
- 🙌 [Credits](#credits)
|
|
39
55
|
- 📄 [License](#license)
|
|
40
56
|
|
|
@@ -42,12 +58,14 @@ Provides reusable helpers to simplify your JavaScript / TypeScript projects.<br/
|
|
|
42
58
|
|
|
43
59
|
<h2 id="requirements">💻 Requirements</h2>
|
|
44
60
|
|
|
45
|
-
- **Node.js
|
|
46
|
-
This package leverages modern JavaScript & TypeScript features that require Node.js version 16.0.0 if not using
|
|
61
|
+
- **Node.js `≥16.0.0`**
|
|
62
|
+
This package leverages modern JavaScript & TypeScript features that require Node.js version 16.0.0 if not using Next.js, and for Next.js it must follow the official minimum Node.js version requirement depending on the version you use.
|
|
63
|
+
- 🔗 See official Next.js documentation:
|
|
64
|
+
<a href="https://nextjs.org/docs/getting-started/installation#system-requirements" target="_blank" rel="nofollow noreferrer noopener">NextJS Installation Requirements</a>
|
|
47
65
|
|
|
48
66
|
- Works with:
|
|
49
67
|
- ✅ Node.js (16.0.0+) - Without NextJS
|
|
50
|
-
- ✅ Node.js (18.17.0
|
|
68
|
+
- ✅ Node.js (18.17.0, or higher depending on NextJS version) - With NextJS
|
|
51
69
|
- ✅ Modern browsers (via bundlers like Webpack / Vite)
|
|
52
70
|
|
|
53
71
|
---
|
|
@@ -81,7 +99,7 @@ Provides reusable helpers to simplify your JavaScript / TypeScript projects.<br/
|
|
|
81
99
|
- 📦 Works in **Node.js** & modern browsers
|
|
82
100
|
- ❤️ Simple API, easy to extend
|
|
83
101
|
- 🧬 **Next.js support**: helpers for dynamic routes, building URLs, reading env, extracting client IP
|
|
84
|
-
- 🛠 Additional TypeScript types: `OmitStrict`, `
|
|
102
|
+
- 🛠 Additional TypeScript types: `OmitStrict`, `PartialOnly`, etc.
|
|
85
103
|
|
|
86
104
|
---
|
|
87
105
|
|
|
@@ -109,19 +127,28 @@ This package also provides utilities specially built for Next.js environments, n
|
|
|
109
127
|
|
|
110
128
|
<h2 id="detailed-features">💎 Detailed Features</h2>
|
|
111
129
|
|
|
112
|
-
### Full documentation
|
|
113
|
-
#### For now, explore the examples or dive into the source — all utilities are documented via **
|
|
130
|
+
### Full documentation <a href="https://docs-rzl-utils-js.vercel.app" target="_blank" rel="nofollow noreferrer noopener">Rzl UtilsJS</a> is **currently under construction** 🏗️.
|
|
131
|
+
#### For now, explore the examples or dive into the source — all utilities are documented via **TSDoc** and typed properly.
|
|
114
132
|
|
|
115
133
|
```ts
|
|
116
|
-
import { | } from "@rzl-zone/utils-js/
|
|
117
|
-
import { | } from "@rzl-zone/utils-js
|
|
118
|
-
import { | } from "@rzl-zone/utils-js
|
|
119
|
-
import { | } from "@rzl-zone/utils-js
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
134
|
+
import { | } from "@rzl-zone/utils-js/assertions";
|
|
135
|
+
import { | } from "@rzl-zone/utils-js/conversions";
|
|
136
|
+
import { | } from "@rzl-zone/utils-js/events";
|
|
137
|
+
import { | } from "@rzl-zone/utils-js/formatters";
|
|
138
|
+
import { | } from "@rzl-zone/utils-js/generators";
|
|
139
|
+
import { | } from "@rzl-zone/utils-js/next";
|
|
140
|
+
import { | } from "@rzl-zone/utils-js/next/server";
|
|
141
|
+
import { | } from "@rzl-zone/utils-js/operations";
|
|
142
|
+
import { | } from "@rzl-zone/utils-js/parsers";
|
|
143
|
+
import { | } from "@rzl-zone/utils-js/predicates";
|
|
144
|
+
import { | } from "@rzl-zone/utils-js/promises";
|
|
145
|
+
import { | } from "@rzl-zone/utils-js/strings";
|
|
146
|
+
import { | } from "@rzl-zone/utils-js/tailwind";
|
|
147
|
+
import { | } from "@rzl-zone/utils-js/urls";
|
|
148
|
+
|
|
149
|
+
import type { | } from "@rzl-zone/utils-js/types";
|
|
124
150
|
```
|
|
151
|
+
#### Just place your cursor right inside `{ }` or after import from `"@rzl-zone/utils-js/{{ | }}"` like the pipe ("|") above then ctrl + space, there are many functions or types and then hover to each function is complete with how to use it because I have added tsDoc.
|
|
125
152
|
|
|
126
153
|
<!-- - <h4 id="detailed-features--assertions">
|
|
127
154
|
Assertions -
|
|
@@ -148,23 +175,23 @@ This package also provides utilities specially built for Next.js environments, n
|
|
|
148
175
|
|
|
149
176
|
<h2 id="usage">🔥 Usage</h2>
|
|
150
177
|
|
|
151
|
-
|
|
178
|
+
### Easy to use, just import on your code base.
|
|
152
179
|
|
|
153
|
-
|
|
180
|
+
#### Example Function Import:
|
|
154
181
|
|
|
155
182
|
```ts
|
|
156
|
-
import { isServer } from "@rzl-zone/utils-js";
|
|
183
|
+
import { isServer } from "@rzl-zone/utils-js/predicates";
|
|
157
184
|
|
|
158
185
|
console.log(isServer());
|
|
159
|
-
// true if running on
|
|
186
|
+
// ➔ `true` if running on server-side, `false` if in browser.
|
|
160
187
|
```
|
|
161
188
|
|
|
162
|
-
|
|
189
|
+
#### Example Types Helper Import:
|
|
163
190
|
|
|
164
191
|
```ts
|
|
165
192
|
import type { OmitStrict } from "@rzl-zone/utils-js/types";
|
|
166
193
|
|
|
167
|
-
type MyType = OmitStrict<OtherType, "
|
|
194
|
+
type MyType = OmitStrict<OtherType, "omittingProps">;
|
|
168
195
|
// Fully strict TS omit that requires all keys to exist in target
|
|
169
196
|
```
|
|
170
197
|
|
|
@@ -189,7 +216,7 @@ See [CONTRIBUTING](CONTRIBUTING.md).
|
|
|
189
216
|
|
|
190
217
|
---
|
|
191
218
|
|
|
192
|
-
<h2 id="security"
|
|
219
|
+
<h2 id="security">🔒 Security</h2>
|
|
193
220
|
|
|
194
221
|
Please report issues to [rizalvindwiky1998@gmail.com](mailto:rizalvindwiky1998@gmail.com).
|
|
195
222
|
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** --------------------------------------------------
|
|
2
|
+
* * ***Internal Utility Type for: {@link NumberRangeUnion | `NumberRangeUnion`}.***
|
|
3
|
+
* --------------------------------------------------
|
|
4
|
+
* @template N - Starting/Ending number of the range (inclusive).
|
|
5
|
+
* @template Acc - Internal accumulator for recursion (do not set manually).
|
|
6
|
+
*/
|
|
7
|
+
type Enumerate<N extends number,Acc extends number[]=[]>=Acc["length"] extends N?Acc[number]:Enumerate<N,[...Acc,Acc["length"]]>;
|
|
8
|
+
/** --------------------------------------------------
|
|
9
|
+
* * ***Utility Type: `NumberRangeUnion`.***
|
|
10
|
+
* --------------------------------------------------
|
|
11
|
+
* **Generate a union type of numbers from `From` to `To` using enumeration.**
|
|
12
|
+
* @description
|
|
13
|
+
* Produces a **numeric union type** from `From` to `To` (inclusive),
|
|
14
|
+
* using a simpler approach based on `Enumerate<N>` helper type.
|
|
15
|
+
* - ✅ Straightforward & easy to reason about.
|
|
16
|
+
* - ⚠️ Still limited by TypeScript recursion depth (safe up to `999`).
|
|
17
|
+
* - ⚙️ Best used for **smaller ranges** (`≤ 100`) or when readability matters.
|
|
18
|
+
* - ℹ️ For **larger ranges** (`≥ 101`) use {@link NumberRangeLimit | `NumberRangeLimit`} instead.
|
|
19
|
+
* @template From - Starting number of the range (inclusive).
|
|
20
|
+
* @template To - Ending number of the range (inclusive).
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* type RangeA = NumberRangeUnion<3, 6>;
|
|
24
|
+
* // ➔ 3 | 4 | 5 | 6
|
|
25
|
+
* type RangeB = NumberRangeUnion<0, 2>;
|
|
26
|
+
* // ➔ 0 | 1 | 2
|
|
27
|
+
* type RangeC = NumberRangeUnion<8, 8>;
|
|
28
|
+
* // ➔ 8
|
|
29
|
+
* type RangeD = NumberRangeUnion<20, 10>;
|
|
30
|
+
* // ➔ 10
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
type NumberRangeUnion<From extends number,To extends number>=From extends To?From:Exclude<Enumerate<To>,Enumerate<From>>extends never?To:Exclude<Enumerate<To>,Enumerate<From>>|To;export type{NumberRangeUnion as N};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import{I as If}from'./if-
|
|
1
|
+
import{I as If}from'./if-ChM35c_q.js';
|
|
2
2
|
/** -------------------------------------------------------
|
|
3
|
-
* * ***IsAny
|
|
3
|
+
* * ***Utility Type: `IsAny`.***
|
|
4
4
|
* -------------------------------------------------------
|
|
5
|
-
* A type-level utility that checks whether a type is ***`any
|
|
6
|
-
* -
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* **A type-level utility that checks whether a type is ***`any`***.**
|
|
6
|
+
* - **Behavior:**
|
|
7
|
+
* - Returns `true` if `T` is `any`.
|
|
8
|
+
* - Returns `false` for otherwise.
|
|
9
9
|
* @template T - The type to evaluate.
|
|
10
10
|
* @example
|
|
11
11
|
* ```ts
|
|
@@ -17,18 +17,16 @@ import{I as If}from'./if-CvT4R7Kh.js';
|
|
|
17
17
|
*/
|
|
18
18
|
type IsAny<T>=0 extends 1 & T?true:false;
|
|
19
19
|
/** -------------------------------------------------------
|
|
20
|
-
* * ***IfAny
|
|
20
|
+
* * ***Utility Type: `IfAny`.***
|
|
21
21
|
* -------------------------------------------------------
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
22
|
+
* **A type-level conditional utility that returns one type if ***`T` is `any`***,
|
|
23
|
+
* and another type otherwise.**
|
|
24
|
+
* - **Behavior:**
|
|
25
|
+
* - Defaults to `true` when `T` is `any`.
|
|
26
|
+
* - Defaults to `false` for otherwise.
|
|
28
27
|
* @template T - The type to check.
|
|
29
|
-
* @template IfTrue - The type to return if `T` is `any
|
|
30
|
-
* @template IfFalse - The type to return if `T` is not `any
|
|
31
|
-
*
|
|
28
|
+
* @template IfTrue - The type to return if `T` is `any`, *(default: `true`)*.
|
|
29
|
+
* @template IfFalse - The type to return if `T` is not `any`, *(default: `false`)*.
|
|
32
30
|
* @example
|
|
33
31
|
* ```ts
|
|
34
32
|
* type A = IfAny<any, string, number>;
|
|
@@ -38,7 +36,9 @@ type IsAny<T>=0 extends 1 & T?true:false;
|
|
|
38
36
|
* ```
|
|
39
37
|
*/
|
|
40
38
|
type IfAny<T,IfTrue=true,IfFalse=false>=If<IsAny<T>,IfTrue,IfFalse>;
|
|
41
|
-
/** Configuration options for a type-level utility
|
|
39
|
+
/** * ***Configuration options for a type-level utility for
|
|
40
|
+
* {@link AnifyProperties | `AnifyProperties`}.***
|
|
41
|
+
*/
|
|
42
42
|
type AnifyPropertiesOptions={
|
|
43
43
|
/** If `makeOptional: true`, all properties become optional, otherwise, all properties are required and typed as `any`, defaultValue: `false`.
|
|
44
44
|
*
|
|
@@ -46,20 +46,19 @@ type AnifyPropertiesOptions={
|
|
|
46
46
|
*/
|
|
47
47
|
makeOptional:boolean;};
|
|
48
48
|
/** -------------------------------------------------------
|
|
49
|
-
* * ***AnifyProperties
|
|
49
|
+
* * ***Utility Type: `AnifyProperties`.***
|
|
50
50
|
* -------------------------------------------------------
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
* -
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* @template T
|
|
57
|
-
* @template Options
|
|
51
|
+
* **A type-level utility that transforms all properties of an object
|
|
52
|
+
* into ***`any`***.**
|
|
53
|
+
* - **Behavior:**
|
|
54
|
+
* - If `makeOptional: true`, all properties become optional.
|
|
55
|
+
* - Otherwise, all properties are required and typed as `any`.
|
|
56
|
+
* @template T The object type to transform.
|
|
57
|
+
* @template Options Configuration options, defaults to `{ makeOptional: false }`.
|
|
58
58
|
* @example
|
|
59
59
|
* ```ts
|
|
60
60
|
* type A = AnifyProperties<{a: string; b: number}>;
|
|
61
61
|
* // ➔ { a: any; b: any }
|
|
62
|
-
*
|
|
63
62
|
* type B = AnifyProperties<{a: string; b: number}, { makeOptional: true }>;
|
|
64
63
|
* // ➔ { a?: any; b?: any }
|
|
65
64
|
* ```
|
package/dist/{arrays-normalize-recursive-CnjYJ9xg.d.ts → arrays-normalize-recursive-BqmVuFlD.d.ts}
RENAMED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/** -------------------------------------------------------
|
|
2
|
-
* * ***FixNeverArrayRecursive
|
|
2
|
+
* * ***Utility Type: `FixNeverArrayRecursive`.***
|
|
3
3
|
* -------------------------------------------------------
|
|
4
|
-
* A type-level utility that **recursively transforms arrays of type `never[]` into empty arrays
|
|
5
|
-
* -
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
4
|
+
* **A type-level utility that **recursively transforms arrays of type `never[]` into empty arrays**.**
|
|
5
|
+
* - **Behavior:**
|
|
6
|
+
* - Preserves `readonly` modifiers.
|
|
7
|
+
* - Applies recursively for nested arrays.
|
|
8
|
+
* - Leaves other types unchanged.
|
|
9
9
|
* @template T - The input type to recursively fix.
|
|
10
10
|
* @example
|
|
11
11
|
* ```ts
|
|
@@ -23,13 +23,13 @@
|
|
|
23
23
|
*/
|
|
24
24
|
type FixNeverArrayRecursive<T>=T extends readonly never[]?T extends never[]?[]:readonly []:T extends(infer U)[]?FixNeverArrayRecursive<U>[]:T extends readonly(infer U)[]?readonly FixNeverArrayRecursive<U>[]:T;
|
|
25
25
|
/** -------------------------------------------------------
|
|
26
|
-
* * ***NormalizeEmptyArraysRecursive
|
|
26
|
+
* * ***Utility Type: `NormalizeEmptyArraysRecursive`.***
|
|
27
27
|
* -------------------------------------------------------
|
|
28
|
-
* A type-level utility that **recursively normalizes empty array types** by converting arrays whose element type is `never`, `null`, or `undefined` into empty tuple types (`[]`)
|
|
29
|
-
* -
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
28
|
+
* **A type-level utility that **recursively normalizes empty array types** by converting arrays whose element type is `never`, `null`, or `undefined` into empty tuple types (`[]`).**
|
|
29
|
+
* - **Behavior:**
|
|
30
|
+
* - Preserves `readonly` modifiers.
|
|
31
|
+
* - Recurses into nested arrays.
|
|
32
|
+
* - Leaves other array types unchanged.
|
|
33
33
|
* @template T - The input type to normalize.
|
|
34
34
|
* @example
|
|
35
35
|
* ```ts
|
|
@@ -47,15 +47,15 @@ type FixNeverArrayRecursive<T>=T extends readonly never[]?T extends never[]?[]:r
|
|
|
47
47
|
*/
|
|
48
48
|
type NormalizeEmptyArraysRecursive<T>=T extends readonly(infer U)[]?U extends never|null|undefined?T extends readonly unknown[]?T extends(infer E)[]?[]:readonly []:never:T extends(infer E)[]?NormalizeEmptyArraysRecursive<U>[]:readonly NormalizeEmptyArraysRecursive<U>[]:T;
|
|
49
49
|
/** -------------------------------------------------------
|
|
50
|
-
* * ***RemoveEmptyArrayElements
|
|
50
|
+
* * ***Utility Type: `RemoveEmptyArrayElements`.***
|
|
51
51
|
* -------------------------------------------------------
|
|
52
|
-
* A type-level utility that **recursively removes empty array elements (`[]`) from a tuple type
|
|
53
|
-
* -
|
|
54
|
-
* - If `
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
52
|
+
* **A type-level utility that **recursively removes empty array elements (`[]`) from a tuple type**.**
|
|
53
|
+
* - **Behavior:**
|
|
54
|
+
* - If `T` is a tuple, checks the first element:
|
|
55
|
+
* - If `Head` is an empty array type (`[]`), it is removed.
|
|
56
|
+
* - Otherwise, `Head` is preserved.
|
|
57
|
+
* - Repeats recursively on the rest of the tuple.
|
|
58
|
+
* - Leaves non-tuple types unchanged.
|
|
59
59
|
* @template T - The tuple type to process.
|
|
60
60
|
* @example
|
|
61
61
|
* ```ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";var e=require("../chunk-IVL7CKVH.cjs"),r=require("../chunk-HYRQMTRH.cjs"),t=require("../chunk-6JFZL7YE.cjs");require("../chunk-UDA26MCU.cjs");var s=require("../chunk-PZQ6I4JJ.cjs");Object.defineProperty(exports,"assertIsBigInt",{enumerable:!0,get:function(){return e.assertIsBigInt}}),Object.defineProperty(exports,"assertIsNumber",{enumerable:!0,get:function(){return e.assertIsNumber}}),Object.defineProperty(exports,"assertIsString",{enumerable:!0,get:function(){return r.assertIsString}}),Object.defineProperty(exports,"assertIsArray",{enumerable:!0,get:function(){return t.assertIsArray}}),Object.defineProperty(exports,"assertIsBoolean",{enumerable:!0,get:function(){return s.assertIsBoolean}}),Object.defineProperty(exports,"assertIsPlainObject",{enumerable:!0,get:function(){return s.assertIsPlainObject}});
|