@rzl-zone/utils-js 3.2.6-beta.0 → 3.3.1
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 +82 -51
- 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-OGPPP2S3.js → chunk-3VA554KW.js} +1 -1
- package/dist/{chunk-FV7SEBKD.cjs → chunk-5757UBXJ.cjs} +1 -1
- package/dist/{chunk-MTUBDVJ2.js → chunk-5IGC6PBH.js} +1 -1
- package/dist/{chunk-O7UT5AN3.cjs → chunk-5KJFVIQT.cjs} +1 -1
- package/dist/chunk-6JFCSH7J.js +1 -0
- package/dist/{chunk-VHAPTHEA.cjs → chunk-6JFZL7YE.cjs} +1 -1
- package/dist/chunk-7ODAAXX5.cjs +1 -0
- package/dist/{chunk-6C3ATUGM.cjs → chunk-CAH33WOQ.cjs} +1 -1
- package/dist/{chunk-ECRNH4FW.js → chunk-CKTLUNWX.js} +1 -1
- package/dist/chunk-CMW2TBOQ.js +1 -0
- package/dist/chunk-D3ENH7H6.cjs +1 -0
- package/dist/{chunk-3YCFMGRB.js → chunk-DEZZUYE2.js} +1 -1
- package/dist/chunk-DWF2R5GD.cjs +1 -0
- package/dist/chunk-E55EQK2U.cjs +1 -0
- package/dist/chunk-E74U6CYP.cjs +1 -0
- package/dist/{chunk-XC3QHAK2.cjs → chunk-EL6A35UR.cjs} +1 -1
- package/dist/chunk-F6IPNNSJ.cjs +1 -0
- package/dist/chunk-FJZGG54N.cjs +1 -0
- package/dist/chunk-FWCKOJZM.js +1 -0
- package/dist/{chunk-IMCLPT5V.cjs → chunk-FWHNWL2P.cjs} +1 -1
- package/dist/chunk-GGEADHZO.js +1 -0
- package/dist/{chunk-IRGE5W7L.js → chunk-GQR4R5WY.js} +1 -1
- package/dist/chunk-H66AC7GK.cjs +1 -0
- package/dist/{chunk-M47QIBXI.cjs → chunk-HQWOFR56.cjs} +1 -1
- package/dist/{chunk-VCFXNV3Q.cjs → chunk-HYRQMTRH.cjs} +1 -1
- package/dist/{chunk-EUANTHVN.js → chunk-IRFL4MAX.js} +1 -1
- package/dist/{chunk-GGWPB23G.cjs → chunk-IVL7CKVH.cjs} +1 -1
- 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-KVAL5PAG.cjs +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-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-YV3K2EKJ.js → chunk-RIPKY4RU.js} +1 -1
- package/dist/chunk-RZW35UN5.cjs +1 -0
- package/dist/chunk-SBFNXGTJ.js +1 -0
- package/dist/{chunk-T4CIAKEK.js → chunk-SBKGWRS5.js} +1 -1
- package/dist/{chunk-5Z2G23WP.js → chunk-SIM77PU4.js} +1 -1
- package/dist/chunk-T2T7K3KR.js +1 -0
- package/dist/chunk-T7PU2V7X.cjs +1 -0
- package/dist/chunk-V45XJKHW.cjs +1 -0
- package/dist/chunk-W2WNBUDE.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-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/{formatting → formatters}/index.cjs +1 -1
- 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/index.d.ts +14 -0
- 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 -1
- package/dist/next/index.d.ts +15 -12
- package/dist/next/index.js +1 -1
- package/dist/next/server/index.cjs +1 -1
- package/dist/next/server/index.d.ts +1 -1
- package/dist/next/server/index.js +1 -1
- 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 -1
- 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 -1
- package/dist/tailwind/index.d.ts +23 -17
- package/dist/tailwind/index.js +1 -1
- 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 +33 -40
- package/dist/NumberRangeUnion-DC-C3_Kq.d.ts +0 -26
- package/dist/chunk-2HSNUPEO.cjs +0 -1
- package/dist/chunk-4Z75R3IT.cjs +0 -1
- package/dist/chunk-AJ25PWXX.cjs +0 -1
- package/dist/chunk-BHIBDDQF.js +0 -1
- package/dist/chunk-CE4JI2YB.js +0 -1
- package/dist/chunk-CMJ6UYWW.cjs +0 -1
- package/dist/chunk-D3VSHABU.cjs +0 -1
- package/dist/chunk-DG2GWBTS.cjs +0 -1
- package/dist/chunk-EKS4IZJR.cjs +0 -1
- package/dist/chunk-EOZKYR5S.cjs +0 -1
- package/dist/chunk-EW3I4O7X.js +0 -1
- package/dist/chunk-F3E77L46.js +0 -1
- package/dist/chunk-G5LXIEFO.js +0 -0
- package/dist/chunk-GVWGQNLF.js +0 -1
- package/dist/chunk-H3FXL4DU.cjs +0 -1
- package/dist/chunk-HHPDLSX2.cjs +0 -1
- package/dist/chunk-JARPXKBM.cjs +0 -1
- package/dist/chunk-JFJUPYDT.cjs +0 -1
- package/dist/chunk-JLP56WSM.js +0 -1
- package/dist/chunk-K3MV4AIN.cjs +0 -1
- package/dist/chunk-KOVO72OM.js +0 -1
- package/dist/chunk-LJ4M3VGE.js +0 -1
- package/dist/chunk-LJVGJLP4.js +0 -1
- package/dist/chunk-MISCBZJC.js +0 -1
- package/dist/chunk-MMSYCIJ2.cjs +0 -1
- package/dist/chunk-OLPKAX7F.cjs +0 -1
- package/dist/chunk-ORZFHBEY.js +0 -1
- package/dist/chunk-OWV2P376.js +0 -1
- package/dist/chunk-RV2WK5E6.js +0 -1
- package/dist/chunk-SBF43G3B.cjs +0 -1
- package/dist/chunk-X74TUJSE.cjs +0 -1
- package/dist/chunk-XLDAIZRK.js +0 -1
- package/dist/chunk-XZJ7C4N6.js +0 -1
- package/dist/chunk-ZHV5ZYVN.cjs +0 -1
- package/dist/chunk-ZL7J6GTP.js +0 -1
- package/dist/chunk-ZTCLKKMB.js +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.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/type-data-DDs-u2kq.d.ts +0 -261
- /package/dist/{chunk-5C2SMIGX.cjs → chunk-BAV5T2E3.cjs} +0 -0
- /package/dist/{chunk-MC3LXMCQ.js → chunk-L5RDAVVH.js} +0 -0
- /package/dist/{chunk-J2RGTPGK.cjs → chunk-VJDDGRIK.cjs} +0 -0
- /package/dist/{chunk-FIAAX3UE.js → chunk-YWHHVDT4.js} +0 -0
package/README.md
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
</div>
|
|
4
4
|
|
|
5
5
|
<p align="center">
|
|
6
|
-
🚀 <strong>Rzl Utility
|
|
7
|
-
A lightweight, modern TypeScript utility library for Node.js & browser (via bundlers like Webpack/Vite)
|
|
8
|
-
Provides reusable helpers to simplify your JavaScript
|
|
9
|
-
<strong>Built with ❤️ by <a href="https://github.com/rzl-app" target="_blank" rel="nofollow noreferrer noopener">@rzl-app</a>.</strong>
|
|
6
|
+
🚀 <strong><u>Rzl Utility JS</u></strong> 🚀<br/>
|
|
7
|
+
<i>A lightweight, modern TypeScript utility library for Node.js & browser (via bundlers like Webpack/Vite).</i><br/>
|
|
8
|
+
<i>Provides reusable helpers to simplify your JavaScript or TypeScript projects.</i><br/>
|
|
9
|
+
<strong><i>Built with ❤️ by <a href="https://github.com/rzl-app" target="_blank" rel="nofollow noreferrer noopener">@rzl-app</a>.</i></strong>
|
|
10
10
|
</p>
|
|
11
11
|
|
|
12
12
|
<div align="center">
|
|
@@ -19,7 +19,7 @@ Provides reusable helpers to simplify your JavaScript / TypeScript projects.<br/
|
|
|
19
19
|
<img src="https://img.shields.io/npm/dt/@rzl-zone/utils-js?style=flat-rounded" alt="Downloads">
|
|
20
20
|
</a>
|
|
21
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
|
|
22
|
+
<img src="https://img.shields.io/badge/node-≥16.0.0-blue.svg?logo=node.js&style=flat-rounded" alt="Node.js">
|
|
23
23
|
</a>
|
|
24
24
|
<a href="https://github.com/rzl-zone/utils-js/blob/main/CONTRIBUTING.md" target="_blank" rel="nofollow noreferrer noopener">
|
|
25
25
|
<img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" alt="PRs Welcome">
|
|
@@ -39,13 +39,15 @@ Provides reusable helpers to simplify your JavaScript / TypeScript projects.<br/
|
|
|
39
39
|
|
|
40
40
|
---
|
|
41
41
|
|
|
42
|
-
<h2 id="table-of-contents">📚 Table of Contents</h2>
|
|
42
|
+
<h2 id="table-of-contents">📚 <strong>Table of Contents</strong></h2>
|
|
43
43
|
|
|
44
44
|
- 💻 [Requirements](#requirements)
|
|
45
45
|
- ⚙️ [Installation](#installation)
|
|
46
46
|
- ✨ [Features](#features)
|
|
47
47
|
- 🧬 [NextJS Support](#nextjs-support)
|
|
48
48
|
- 💎 [Detailed Features](#detailed-features)
|
|
49
|
+
- [Full documentation](#full-documentation-rzl-utilsjs-is-currently-under-construction-%EF%B8%8F)
|
|
50
|
+
- [Hint Autocomplete](#hint-autocomplete)
|
|
49
51
|
- 🔥 [Usage](#usage)
|
|
50
52
|
- ❤️ [Sponsor](#sponsor-this-package)
|
|
51
53
|
- 📜 [Changelog](#changelog)
|
|
@@ -56,35 +58,35 @@ Provides reusable helpers to simplify your JavaScript / TypeScript projects.<br/
|
|
|
56
58
|
|
|
57
59
|
---
|
|
58
60
|
|
|
59
|
-
<h2 id="requirements">💻 Requirements</h2>
|
|
61
|
+
<h2 id="requirements">💻 <strong>Requirements</strong></h2>
|
|
60
62
|
|
|
61
|
-
- **Node.js `≥16.0.0
|
|
63
|
+
- **Node.js `≥16.0.0`**
|
|
62
64
|
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
65
|
- 🔗 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
|
|
66
|
+
<a href="https://nextjs.org/docs/getting-started/installation#system-requirements" target="_blank" rel="nofollow noreferrer noopener"><i>NextJS Installation Requirements.</i></a>
|
|
65
67
|
|
|
66
|
-
- Works with
|
|
68
|
+
- **Works with:**
|
|
67
69
|
- ✅ Node.js (16.0.0+) - Without NextJS
|
|
68
70
|
- ✅ Node.js (18.17.0, or higher depending on NextJS version) - With NextJS
|
|
69
71
|
- ✅ Modern browsers (via bundlers like Webpack / Vite)
|
|
70
72
|
|
|
71
73
|
---
|
|
72
74
|
|
|
73
|
-
<h2 id="installation">⚙️ Installation</h2>
|
|
75
|
+
<h2 id="installation">⚙️ <strong>Installation</strong></h2>
|
|
74
76
|
|
|
75
|
-
#### With NPM
|
|
77
|
+
#### *With NPM*
|
|
76
78
|
|
|
77
79
|
```bash
|
|
78
80
|
npm install @rzl-zone/utils-js
|
|
79
81
|
```
|
|
80
82
|
|
|
81
|
-
#### With Yarn
|
|
83
|
+
#### *With Yarn*
|
|
82
84
|
|
|
83
85
|
```bash
|
|
84
86
|
yarn add @rzl-zone/utils-js
|
|
85
87
|
```
|
|
86
88
|
|
|
87
|
-
#### With PNPM
|
|
89
|
+
#### *With PNPM*
|
|
88
90
|
|
|
89
91
|
```bash
|
|
90
92
|
pnpm add @rzl-zone/utils-js
|
|
@@ -92,20 +94,20 @@ Provides reusable helpers to simplify your JavaScript / TypeScript projects.<br/
|
|
|
92
94
|
|
|
93
95
|
---
|
|
94
96
|
|
|
95
|
-
<h2 id="features">✨ Features</h2>
|
|
97
|
+
<h2 id="features">✨ <strong>Features</strong></h2>
|
|
96
98
|
|
|
97
99
|
- 🚀 Written in **TypeScript** — fully typed & safe
|
|
98
100
|
- ⚡ Small, tree-shakable & fast
|
|
99
101
|
- 📦 Works in **Node.js** & modern browsers
|
|
100
102
|
- ❤️ Simple API, easy to extend
|
|
101
103
|
- 🧬 **Next.js support**: helpers for dynamic routes, building URLs, reading env, extracting client IP
|
|
102
|
-
- 🛠 Additional TypeScript types: `OmitStrict`, `
|
|
104
|
+
- 🛠 Additional TypeScript types: `OmitStrict`, `PartialOnly`, etc.
|
|
103
105
|
|
|
104
106
|
---
|
|
105
107
|
|
|
106
|
-
<h2 id="nextjs-support">🧬 Next.js Support</h2>
|
|
108
|
+
<h2 id="nextjs-support">🧬 <strong>Next.js Support</strong></h2>
|
|
107
109
|
|
|
108
|
-
This package also provides utilities specially built for Next.js environments, neatly separated into their own entry points
|
|
110
|
+
**This package also provides utilities specially built for Next.js environments, neatly separated into their own entry points:**
|
|
109
111
|
|
|
110
112
|
- <h3 id="nextjs-support--globals">`@rzl-zone/utils-js/next`</h3>
|
|
111
113
|
Helpers for building URLs, generating dynamic routes, reading environment variables, etc.
|
|
@@ -125,32 +127,61 @@ This package also provides utilities specially built for Next.js environments, n
|
|
|
125
127
|
|
|
126
128
|
---
|
|
127
129
|
|
|
128
|
-
<h2 id="detailed-features">💎 Detailed Features</h2>
|
|
130
|
+
<h2 id="detailed-features">💎 <strong>Detailed Features</strong></h2>
|
|
129
131
|
|
|
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**
|
|
132
|
+
### **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
133
|
#### For now, explore the examples or dive into the source — all utilities are documented via **TSDoc** and typed properly.
|
|
132
134
|
|
|
133
135
|
```ts
|
|
134
136
|
import { | } from "@rzl-zone/utils-js/assertions";
|
|
135
|
-
import { | } from "@rzl-zone/utils-js/conversions";
|
|
136
|
-
import { | } from "@rzl-zone/utils-js/env";
|
|
137
|
+
import { | } from "@rzl-zone/utils-js/conversions";
|
|
137
138
|
import { | } from "@rzl-zone/utils-js/events";
|
|
138
|
-
import { | } from "@rzl-zone/utils-js/
|
|
139
|
-
import { | } from "@rzl-zone/utils-js/
|
|
140
|
-
import { | } from "@rzl-zone/utils-js/generator";
|
|
139
|
+
import { | } from "@rzl-zone/utils-js/formatters";
|
|
140
|
+
import { | } from "@rzl-zone/utils-js/generators";
|
|
141
141
|
import { | } from "@rzl-zone/utils-js/next";
|
|
142
142
|
import { | } from "@rzl-zone/utils-js/next/server";
|
|
143
143
|
import { | } from "@rzl-zone/utils-js/operations";
|
|
144
144
|
import { | } from "@rzl-zone/utils-js/parsers";
|
|
145
145
|
import { | } from "@rzl-zone/utils-js/predicates";
|
|
146
|
-
import { | } from "@rzl-zone/utils-js/
|
|
146
|
+
import { | } from "@rzl-zone/utils-js/promises";
|
|
147
147
|
import { | } from "@rzl-zone/utils-js/strings";
|
|
148
|
-
import { | } from "@rzl-zone/utils-js/
|
|
148
|
+
import { | } from "@rzl-zone/utils-js/tailwind";
|
|
149
149
|
import { | } from "@rzl-zone/utils-js/urls";
|
|
150
150
|
|
|
151
151
|
import type { | } from "@rzl-zone/utils-js/types";
|
|
152
152
|
```
|
|
153
|
-
####
|
|
153
|
+
#### Place your cursor inside { } or after "@rzl-zone/utils-js/{{ | }}" then press Ctrl+Space to see all available functions/types with full TSDoc hints.
|
|
154
|
+
---
|
|
155
|
+
### **Hint: Autocomplete**
|
|
156
|
+
|
|
157
|
+
**To get the best autocomplete hints for folders and files, add the `types` field in your configuration file:**
|
|
158
|
+
|
|
159
|
+
#### # **_TypeScript_**:
|
|
160
|
+
Add this to your `tsconfig.json`:
|
|
161
|
+
```jsonc
|
|
162
|
+
// tsconfig.json
|
|
163
|
+
{
|
|
164
|
+
"compilerOptions": {
|
|
165
|
+
"types": [
|
|
166
|
+
"@rzl-zone/utils-js"
|
|
167
|
+
]
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
```
|
|
172
|
+
#### # **_JavaScript_:**
|
|
173
|
+
Add this to your `jsconfig.json`:
|
|
174
|
+
```jsonc
|
|
175
|
+
// jsconfig.json
|
|
176
|
+
{
|
|
177
|
+
"compilerOptions": {
|
|
178
|
+
"types": [
|
|
179
|
+
"@rzl-zone/utils-js"
|
|
180
|
+
]
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
```
|
|
184
|
+
>ℹ️ ***Tip:*** *For JS projects, consider adding "checkJs": true for better IntelliSense.*
|
|
154
185
|
|
|
155
186
|
<!-- - <h4 id="detailed-features--assertions">
|
|
156
187
|
Assertions -
|
|
@@ -175,70 +206,70 @@ This package also provides utilities specially built for Next.js environments, n
|
|
|
175
206
|
-->
|
|
176
207
|
---
|
|
177
208
|
|
|
178
|
-
<h2 id="usage">🔥 Usage</h2>
|
|
209
|
+
<h2 id="usage">🔥 <strong>Usage</strong></h2>
|
|
179
210
|
|
|
180
|
-
### Easy to use, just import on your code base
|
|
211
|
+
### **Easy to use, just import on your code base.**
|
|
181
212
|
|
|
182
|
-
#### Example Function Import
|
|
213
|
+
#### *Example Function Import:*
|
|
183
214
|
|
|
184
215
|
```ts
|
|
185
|
-
import { isServer } from "@rzl-zone/utils-js/
|
|
216
|
+
import { isServer } from "@rzl-zone/utils-js/predicates";
|
|
186
217
|
|
|
187
218
|
console.log(isServer());
|
|
188
|
-
// true if running on
|
|
219
|
+
// ➔ `true` if running on server-side, `false` if in browser.
|
|
189
220
|
```
|
|
190
221
|
|
|
191
|
-
#### Example Types Helper Import
|
|
222
|
+
#### *Example Types Helper Import:*
|
|
192
223
|
|
|
193
224
|
```ts
|
|
194
225
|
import type { OmitStrict } from "@rzl-zone/utils-js/types";
|
|
195
226
|
|
|
196
|
-
type MyType = OmitStrict<OtherType, "
|
|
227
|
+
type MyType = OmitStrict<OtherType, "omittingProps">;
|
|
197
228
|
// Fully strict TS omit that requires all keys to exist in target
|
|
198
229
|
```
|
|
199
230
|
|
|
200
231
|
---
|
|
201
232
|
|
|
202
|
-
<h2 id="sponsor-this-package">❤️ Sponsor this package</h2>
|
|
233
|
+
<h2 id="sponsor-this-package">❤️ <strong>Sponsor this package</strong></h2>
|
|
203
234
|
|
|
204
|
-
Help support development
|
|
205
|
-
[👉 Become a sponsor](https://github.com/sponsors/rzl-app)
|
|
235
|
+
**Help support development:**
|
|
236
|
+
*[👉 Become a sponsor](https://github.com/sponsors/rzl-app)*
|
|
206
237
|
|
|
207
238
|
---
|
|
208
239
|
|
|
209
|
-
<h2 id="changelog">📝 Changelog</h2>
|
|
240
|
+
<h2 id="changelog">📝 <strong>Changelog</strong></h2>
|
|
210
241
|
|
|
211
|
-
See [CHANGELOG](CHANGELOG.md)
|
|
242
|
+
**See [CHANGELOG](CHANGELOG.md).**
|
|
212
243
|
|
|
213
244
|
---
|
|
214
245
|
|
|
215
|
-
<h2 id="contributing">🤝 Contributing</h2>
|
|
246
|
+
<h2 id="contributing">🤝 <strong>Contributing</strong></h2>
|
|
216
247
|
|
|
217
|
-
See [CONTRIBUTING](CONTRIBUTING.md)
|
|
248
|
+
**See [CONTRIBUTING](CONTRIBUTING.md).**
|
|
218
249
|
|
|
219
250
|
---
|
|
220
251
|
|
|
221
|
-
<h2 id="security">🔒 Security</h2>
|
|
252
|
+
<h2 id="security">🔒 <strong>Security</strong></h2>
|
|
222
253
|
|
|
223
|
-
Please report issues to [rizalvindwiky1998@gmail.com](mailto:rizalvindwiky1998@gmail.com)
|
|
254
|
+
**Please report issues to [rizalvindwiky1998@gmail.com](mailto:rizalvindwiky1998@gmail.com).**
|
|
224
255
|
|
|
225
256
|
---
|
|
226
257
|
|
|
227
|
-
<h2 id="credits">🙌 Credits</h2>
|
|
258
|
+
<h2 id="credits">🙌 <strong>Credits</strong></h2>
|
|
228
259
|
|
|
229
|
-
|
|
230
|
-
|
|
260
|
+
**- [Rzl App](https://github.com/rzl-app)**
|
|
261
|
+
**- [All Contributors](../../contributors)**
|
|
231
262
|
|
|
232
263
|
---
|
|
233
264
|
|
|
234
|
-
<h2 id="license">📜 License</h2>
|
|
265
|
+
<h2 id="license">📜 <strong>License</strong></h2>
|
|
235
266
|
|
|
236
|
-
The MIT License (MIT)
|
|
237
|
-
Please see [License File](LICENSE.md) for more information
|
|
267
|
+
**The MIT License (MIT).**
|
|
268
|
+
*Please see **[License File](LICENSE.md)** for more information.*
|
|
238
269
|
|
|
239
270
|
---
|
|
240
271
|
|
|
241
272
|
✅ **Enjoy using `@rzl-zone/utils-js`?**
|
|
242
|
-
Star this repo ⭐ and share it with other JavaScript developers
|
|
273
|
+
*Star this repo [⭐](https://github.com/rzl-zone/utils-js) and share it with other JavaScript developers!*
|
|
243
274
|
|
|
244
275
|
---
|
|
@@ -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
|
-
"use strict";var e=require("../chunk-
|
|
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}});
|