@rzl-zone/utils-js 3.10.0 → 3.11.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 +131 -129
- package/dist/assertions/index.cjs +11 -11
- package/dist/assertions/index.d.ts +487 -215
- package/dist/assertions/index.js +5 -5
- package/dist/{chunk-SN5HAK3Y.js → chunk-22V4WP3H.js} +4 -4
- package/dist/{chunk-EJV5AF4L.js → chunk-2XSZ2ANI.js} +2 -2
- package/dist/{chunk-OSSFLQDD.js → chunk-3T6VSWYX.js} +2 -2
- package/dist/{chunk-3LE6NX57.js → chunk-5WIEDF2J.js} +4 -4
- package/dist/{chunk-WLEZ2KSG.cjs → chunk-6EDFZJZ5.cjs} +126 -126
- package/dist/{chunk-GHU356XQ.js → chunk-6LXWT2I5.js} +3 -3
- package/dist/{chunk-GKDSBOYE.js → chunk-6YGBRENU.js} +3 -3
- package/dist/{chunk-NAOVH4OH.cjs → chunk-7FGNVDEV.cjs} +7 -7
- package/dist/{chunk-X6ULJZ3X.js → chunk-AXDYWO67.js} +2 -2
- package/dist/{chunk-UV5BKAYW.cjs → chunk-B6PMNZ4M.cjs} +7 -7
- package/dist/chunk-BAV5T2E3.cjs +1 -1
- package/dist/{chunk-YHFRCVTN.js → chunk-BLF7SD66.js} +3 -3
- package/dist/{chunk-QZI5PVCI.cjs → chunk-BMZZXZJ2.cjs} +4 -4
- package/dist/{chunk-DXPM4NOU.js → chunk-BOYP3ARU.js} +4 -4
- package/dist/{chunk-UXT4XSUK.js → chunk-BPYW5YL7.js} +2 -2
- package/dist/{chunk-QGTFQ7RO.cjs → chunk-C2PV3VWC.cjs} +6 -6
- package/dist/{chunk-MZ3T6L7Z.js → chunk-CCJ2MSN7.js} +2 -2
- package/dist/{chunk-H44QVAZL.cjs → chunk-DAPAK2W3.cjs} +31 -31
- package/dist/{chunk-OYFUBKEG.cjs → chunk-DLS3G6WQ.cjs} +4 -4
- package/dist/{chunk-MS2KSKD7.js → chunk-DNMCR5JH.js} +9 -9
- package/dist/chunk-DVMHRLKP.cjs +1 -1
- package/dist/{chunk-IX6PF5ZP.cjs → chunk-EBYFYZW4.cjs} +4 -4
- package/dist/{chunk-5Y6JL47L.js → chunk-ENMRZ4BE.js} +3 -3
- package/dist/{chunk-7EIFPHV3.js → chunk-FJ4BQFVO.js} +8 -8
- package/dist/{chunk-TJ5OY6MC.cjs → chunk-GIKL4PUF.cjs} +10 -10
- package/dist/{chunk-M5QB2GM5.js → chunk-GOFINGT6.js} +2 -2
- package/dist/{chunk-J6VLFVIL.js → chunk-GXKQ3LHF.js} +3 -3
- package/dist/{chunk-5KDVIEVO.js → chunk-HNBRGN4R.js} +2 -2
- package/dist/{chunk-OCTHWEZK.cjs → chunk-HYN6FC5A.cjs} +34 -34
- package/dist/{chunk-MBFVTGYS.js → chunk-IZGVBYFN.js} +4 -4
- package/dist/{chunk-QXTJVDWE.js → chunk-JIE447J5.js} +3 -3
- package/dist/{chunk-UFYMRRJH.cjs → chunk-JXEIJM5M.cjs} +61 -61
- package/dist/{chunk-WB3FT62A.js → chunk-K47GZDBH.js} +3 -3
- package/dist/{chunk-KUVRZ2JW.cjs → chunk-K5536YHG.cjs} +50 -50
- package/dist/chunk-KHO2SBNA.cjs +1 -1
- package/dist/{chunk-NJ24M6ZH.cjs → chunk-KXJ7X325.cjs} +37 -37
- package/dist/chunk-L5RDAVVH.js +1 -1
- package/dist/{chunk-SRWL4YCP.js → chunk-LJHPTLWB.js} +7 -7
- package/dist/{chunk-6AMDHVS2.cjs → chunk-M7ELWZXM.cjs} +9 -9
- package/dist/chunk-MSUW5VHZ.js +1590 -0
- package/dist/{chunk-2XGQQZ6A.cjs → chunk-MUHRPRR7.cjs} +3 -3
- package/dist/{chunk-XYWC4EQ3.cjs → chunk-MV3TSQSH.cjs} +71 -71
- package/dist/{chunk-VCYXNIZ2.cjs → chunk-NLZLXWAU.cjs} +9 -9
- package/dist/{chunk-76ATVDCR.cjs → chunk-NVRZPF5M.cjs} +3 -3
- package/dist/chunk-ONZFBJVW.js +1 -1
- package/dist/{chunk-62FS7WMB.cjs → chunk-PGNL7JXO.cjs} +31 -31
- package/dist/{chunk-JI57K7D4.cjs → chunk-Q4GEQS7X.cjs} +161 -161
- package/dist/chunk-QNKGP5DY.js +1 -1
- package/dist/{chunk-ZTHJQJ5F.cjs → chunk-QYI2VJLS.cjs} +9 -9
- package/dist/{chunk-C7GC2PFX.js → chunk-RBWZII5I.js} +3 -3
- package/dist/{chunk-MMRHKYT6.cjs → chunk-RMP7VMPB.cjs} +12 -12
- package/dist/{chunk-TXOVQZPU.js → chunk-RZOGBYIS.js} +2 -2
- package/dist/{chunk-ALRISPTL.cjs → chunk-SU3UELUB.cjs} +3 -3
- package/dist/chunk-SYHPSOUU.cjs +1626 -0
- package/dist/{chunk-R2DR7SPJ.js → chunk-SZUNAEMR.js} +6 -6
- package/dist/{chunk-YVRUY4EW.cjs → chunk-TER22LO4.cjs} +8 -8
- package/dist/{chunk-WRGN6UBK.js → chunk-TJHGRQ4P.js} +2 -2
- package/dist/{chunk-I33PB44Q.cjs → chunk-U23I7JPB.cjs} +15 -15
- package/dist/{chunk-VBSLIIDB.js → chunk-U7HHN47R.js} +10 -10
- package/dist/chunk-UDA26MCU.cjs +1 -1
- package/dist/{chunk-44X74C26.js → chunk-UIAWUZ4H.js} +4 -4
- package/dist/{chunk-5O66AUEC.js → chunk-ULQPCIA2.js} +2 -2
- package/dist/chunk-VJDDGRIK.cjs +1 -1
- package/dist/{chunk-6WVOUVWD.js → chunk-WETQI6HM.js} +9 -9
- package/dist/{chunk-FWWPEL7J.cjs → chunk-WLOQQFDS.cjs} +3 -3
- package/dist/chunk-WVSPXFTY.js +1 -1
- package/dist/{chunk-WKM6UVMG.cjs → chunk-WXFTVXBF.cjs} +4 -4
- package/dist/{chunk-YQHJB7KR.cjs → chunk-XPVTIGU2.cjs} +26 -26
- package/dist/{chunk-PWKOFPAH.cjs → chunk-XX6RUGTM.cjs} +3 -3
- package/dist/chunk-YWHHVDT4.js +1 -1
- package/dist/{chunk-7NXFGJJE.cjs → chunk-ZPDMWDGZ.cjs} +14 -14
- package/dist/{chunk-JYOCB6OV.js → chunk-ZVWZEGQP.js} +2 -2
- package/dist/conversions/index.cjs +34 -34
- package/dist/conversions/index.d.ts +489 -333
- package/dist/conversions/index.js +15 -15
- package/dist/events/index.cjs +8 -8
- package/dist/events/index.d.ts +35 -29
- package/dist/events/index.js +4 -4
- package/dist/formatters/index.cjs +19 -19
- package/dist/formatters/index.d.ts +917 -873
- package/dist/formatters/index.js +9 -9
- package/dist/generators/index.cjs +9 -9
- package/dist/generators/index.d.ts +104 -86
- package/dist/generators/index.js +4 -4
- package/dist/index.d.ts +1 -1
- package/dist/isPlainObject-0p3VveWr.d.ts +534 -0
- package/dist/next/index.cjs +37 -37
- package/dist/next/index.d.ts +36 -21
- package/dist/next/index.js +9 -9
- package/dist/next/server/index.cjs +4 -4
- package/dist/next/server/index.d.ts +6 -3
- package/dist/next/server/index.js +2 -2
- package/dist/operations/index.cjs +11 -11
- package/dist/operations/index.d.ts +14 -5
- package/dist/operations/index.js +8 -8
- package/dist/parsers/index.cjs +6 -6
- package/dist/parsers/index.d.ts +68 -65
- package/dist/parsers/index.js +5 -5
- package/dist/predicates/index.cjs +77 -77
- package/dist/predicates/index.d.ts +442 -258
- package/dist/predicates/index.js +14 -14
- package/dist/promises/index.cjs +6 -6
- package/dist/promises/index.d.ts +28 -16
- package/dist/promises/index.js +4 -4
- package/dist/rzl-utils.global.js +2 -2
- package/dist/strings/index.cjs +23 -23
- package/dist/strings/index.d.ts +82 -54
- package/dist/strings/index.js +7 -7
- package/dist/tailwind/index.cjs +13 -13
- package/dist/tailwind/index.d.ts +186 -169
- package/dist/tailwind/index.js +5 -5
- package/dist/urls/index.cjs +23 -23
- package/dist/urls/index.d.ts +252 -229
- package/dist/urls/index.js +16 -16
- package/package.json +6 -4
- package/dist/chunk-7C7TQC5J.cjs +0 -620
- package/dist/chunk-J4TT33ZX.js +0 -584
- package/dist/isPlainObject-BTPjv6zB.d.ts +0 -178
package/README.md
CHANGED
|
@@ -1,50 +1,50 @@
|
|
|
1
1
|
<div align="center" style="display: flex; flex-direction: column; align-items: center;gap: 0rem">
|
|
2
2
|
<a target="_blank" rel="noopener noreferrer" href="https://raw.githubusercontent.com/rzl-zone/utils-js/main/logo-circle.png">
|
|
3
|
-
<img src="https://raw.githubusercontent.com/rzl-zone/utils-js/main/logo-circle.png" align="middle" alt="RzlZone Logo" width="110" style="max-width: 100%;"
|
|
3
|
+
<img src="https://raw.githubusercontent.com/rzl-zone/utils-js/main/logo-circle.png" align="middle" alt="RzlZone Logo" width="110" style="max-width: 100%;" />
|
|
4
4
|
</a>
|
|
5
5
|
</div>
|
|
6
6
|
|
|
7
|
-
<h1 align="center"><strong>
|
|
7
|
+
<h1 align="center"><strong>UtilsJS</strong></h1>
|
|
8
8
|
|
|
9
|
-
<p align="center">
|
|
10
|
-
<i>
|
|
9
|
+
<p align="center">
|
|
10
|
+
<i>
|
|
11
|
+
A lightweight, modern TypeScript utility library for Node.js & browser (via bundlers like <a href="https://webpack.js.org"><code>Webpack</code></a>, <a href="https://vercel.com/blog/turbopack"><code>Turbopack</code></a>, or <a href="https://vite.dev/"><code>Vite</code></a>).
|
|
12
|
+
</i><br/>
|
|
11
13
|
<i>Provides reusable helpers to simplify your JavaScript or TypeScript projects.</i><br/>
|
|
12
|
-
<strong><i>Built with ❤️ by <a href="https://github.com/rzl-
|
|
14
|
+
<strong><i>Built with ❤️ by <a href="https://github.com/rzl-zone" target="_blank" rel="nofollow noreferrer noopener">@rzl-zone</a>.</i></strong>
|
|
13
15
|
</p>
|
|
14
16
|
|
|
15
17
|
<div align="center">
|
|
16
|
-
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
</
|
|
42
|
-
</p>
|
|
43
|
-
|
|
18
|
+
<p>
|
|
19
|
+
<a href="https://npmjs.com/package/@rzl-zone/utils-js" target="_blank" rel="nofollow noreferrer noopener">
|
|
20
|
+
<img src="https://img.shields.io/npm/v/@rzl-zone/utils-js?logo=npm&label=Latest%20Version&color=4CAF50&logoColor=CB3837&style=flat-rounded" alt="Latest Version on NPM" />
|
|
21
|
+
</a>
|
|
22
|
+
<a href="https://npmjs.com/package/@rzl-zone/utils-js" target="_blank" rel="nofollow noreferrer noopener">
|
|
23
|
+
<img src="https://img.shields.io/npm/dt/@rzl-zone/utils-js?logo=npm&label=Total%20Downloads&color=007EC6&logoColor=CB3837&style=flat-rounded" alt="NPM Total Downloads" />
|
|
24
|
+
</a>
|
|
25
|
+
<a href="https://npmjs.com/package/@rzl-zone/utils-js" target="_blank" rel="nofollow noreferrer noopener">
|
|
26
|
+
<img src="https://img.shields.io/npm/dw/@rzl-zone/utils-js?logo=npm&label=Weekly%20Downloads&color=CB3837&logoColor=CB3837&style=flat-rounded" alt="NPM Weekly Downloads" />
|
|
27
|
+
</a>
|
|
28
|
+
<a href="https://nodejs.org/en/" target="_blank" rel="nofollow noreferrer noopener">
|
|
29
|
+
<img src="https://img.shields.io/badge/Node.js-18.18.0%2B-green.svg?logo=node.js&color=339933&style=flat-rounded" alt="Node.js" />
|
|
30
|
+
</a>
|
|
31
|
+
<a href="https://github.com/rzl-zone/utils-js/blob/main/CONTRIBUTING.md" target="_blank" rel="nofollow noreferrer noopener">
|
|
32
|
+
<img src="https://img.shields.io/badge/PRs-Welcome-brightgreen.svg?color=28A745" alt="PRs Welcome" />
|
|
33
|
+
</a>
|
|
34
|
+
<a href="https://github.com/rzl-zone/utils-js/blob/main/LICENSE.md" target="_blank" rel="nofollow noreferrer noopener">
|
|
35
|
+
<img src="https://img.shields.io/badge/License-MIT-blue.svg?color=3DA639" alt="GitHub license" />
|
|
36
|
+
</a>
|
|
37
|
+
<a href="https://github.com/rzl-zone/utils-js" target="_blank" rel="nofollow noreferrer noopener">
|
|
38
|
+
<img src="https://img.shields.io/badge/Repo-on%20GitHub-181717?logo=github" alt="GitHub" />
|
|
39
|
+
</a>
|
|
40
|
+
<a href="https://github.com/orgs/rzl-zone/repositories" target="_blank" rel="nofollow noreferrer noopener">
|
|
41
|
+
<img src="https://img.shields.io/badge/Org-rzl--zone-24292e?logo=github&style=flat-rounded" alt="Repo on GitHub" />
|
|
42
|
+
</a>
|
|
43
|
+
</p>
|
|
44
44
|
</div>
|
|
45
45
|
|
|
46
46
|
---
|
|
47
|
-
|
|
47
|
+
|
|
48
48
|
<h2 id="table-of-contents">📚 <strong>Table of Contents</strong></h2>
|
|
49
49
|
|
|
50
50
|
- 💻 [Requirements](#requirements)
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
- ✨ [Features](#features)
|
|
53
53
|
- 🧬 [NextJS Support](#nextjs-support)
|
|
54
54
|
- 💎 [Detailed Features](#detailed-features)
|
|
55
|
-
- [Full
|
|
55
|
+
- [Full Documentation](#detailed-features--full-documentation)
|
|
56
56
|
- [CDN Usage](#detailed-features--cdn-usage)
|
|
57
57
|
- [Hint Autocomplete](#detailed-features--hint-autocomplete-setup)
|
|
58
58
|
- 🔥 [Usage](#usage)
|
|
@@ -70,19 +70,22 @@
|
|
|
70
70
|
- **Node.js `≥18.18.0`**
|
|
71
71
|
This package leverages modern JavaScript & TypeScript features that require Node.js version 18.18.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.
|
|
72
72
|
- 🔗 See official Next.js documentation:
|
|
73
|
-
<a href="https://nextjs.org/docs/getting-started/installation#system-requirements" target="_blank" rel="nofollow noreferrer noopener"><i>NextJS
|
|
73
|
+
<a href="https://nextjs.org/docs/getting-started/installation#system-requirements" target="_blank" rel="nofollow noreferrer noopener"><i><strong>NextJS System Requirements</strong></i></a>.
|
|
74
74
|
|
|
75
75
|
- **Works with:**
|
|
76
76
|
- ✅ Node.js (18.18.0+) - ***Without NextJS***.
|
|
77
77
|
- ✅ Node.js (20.9.0, or higher depending on NextJS version) - ***With NextJS***.
|
|
78
|
-
- ✅ Modern browsers (via bundlers like Webpack / Vite).
|
|
78
|
+
- ✅ Modern browsers (via bundlers like [`Webpack`](https://webpack.js.org), [`Turbopack`](https://vercel.com/blog/turbopack), or [`Vite`](https://vite.dev)).
|
|
79
79
|
|
|
80
80
|
- **TypeScript Build Info:**
|
|
81
|
-
- Target: `ES2022
|
|
82
|
-
- Module: `ES2022
|
|
83
|
-
- Module Resolution: `bundler
|
|
81
|
+
- Target: `ES2022`.
|
|
82
|
+
- Module: `ES2022`.
|
|
83
|
+
- Module Resolution: `bundler`.
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
<br/>
|
|
86
|
+
|
|
87
|
+
> ℹ️ Note:
|
|
88
|
+
> These TypeScript settings are used to build the package, consumers do **not** need to match these settings unless they plan to build or modify the source code.
|
|
86
89
|
|
|
87
90
|
---
|
|
88
91
|
|
|
@@ -110,65 +113,67 @@ pnpm add @rzl-zone/utils-js@latest
|
|
|
110
113
|
|
|
111
114
|
<h2 id="features">✨ <strong>Features</strong></h2>
|
|
112
115
|
|
|
113
|
-
- 🚀 Written in **TypeScript** — fully typed & safe
|
|
114
|
-
- ⚡ Small, tree-shakable & fast
|
|
115
|
-
- 📦 Works in **Node.js** & modern browsers
|
|
116
|
-
- ❤️ Simple API, easy to extend
|
|
117
|
-
- 🧬 **Next.js support**: helpers for dynamic routes, building URLs, reading env, extracting client IP
|
|
116
|
+
- 🚀 Written in **TypeScript** — fully typed & safe.
|
|
117
|
+
- ⚡ Small, tree-shakable & fast.
|
|
118
|
+
- 📦 Works in **Node.js** & modern browsers.
|
|
119
|
+
- ❤️ Simple API, easy to extend.
|
|
120
|
+
- 🧬 **Next.js support**: helpers for dynamic routes, building URLs, reading env, extracting client IP.
|
|
121
|
+
|
|
118
122
|
---
|
|
119
123
|
|
|
120
124
|
<h2 id="nextjs-support">🧬 <strong>Next.js Support</strong></h2>
|
|
121
125
|
|
|
122
126
|
**This package also provides utilities specially built for Next.js environments, neatly separated into their own entry points:**
|
|
123
127
|
|
|
124
|
-
- <
|
|
125
|
-
Helpers for building URLs, generating dynamic routes, reading environment variables, etc.
|
|
128
|
+
- <h4 id="nextjs-support--globals"><strong><code>@rzl-zone/utils-js/next</code></strong></h4>
|
|
129
|
+
Helpers for building URLs, generating dynamic routes, reading environment variables, etc.
|
|
126
130
|
|
|
127
131
|
✅ Safe to use in both Next.js pages & API routes.
|
|
128
132
|
|
|
129
|
-
[Read More Docs](/docs/next-js/global.md#docs-sub-main--title)
|
|
133
|
+
[**Read More Docs**](/docs/next-js/global.md#docs-sub-main--title)
|
|
130
134
|
|
|
131
|
-
|
|
135
|
+
---
|
|
132
136
|
|
|
133
|
-
- <
|
|
137
|
+
- <h4 id="nextjs-support--server-only"><strong><code>@rzl-zone/utils-js/next/server</code></strong></h4>
|
|
134
138
|
Utilities meant to run in Next.js server-only contexts (like middleware or server actions) for tasks such as extracting real client IPs.
|
|
135
139
|
|
|
136
140
|
> ⚠️ Will throw Error if used outside a ***Next.js* server environment**.
|
|
137
141
|
|
|
138
|
-
[Read More Docs](/docs/next-js/server-only.md#docs-sub-main--title)
|
|
142
|
+
[**Read More Docs**](/docs/next-js/server-only.md#docs-sub-main--title)
|
|
139
143
|
|
|
140
144
|
---
|
|
141
145
|
|
|
142
146
|
<h2 id="detailed-features">💎 <strong>Detailed Features</strong></h2>
|
|
143
147
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
148
|
+
<h3 id="detailed-features--full-documentation">
|
|
149
|
+
<strong>
|
|
150
|
+
The full <a href="https://rzlzone.vercel.app/docs/utils-js" target="_blank" rel="nofollow noreferrer noopener">UtilsJS</a> documentation is
|
|
151
|
+
<strong>currently under construction 🏗️</strong>.
|
|
152
|
+
</strong>
|
|
153
|
+
</h3>
|
|
150
154
|
|
|
151
|
-
|
|
155
|
+
#### For now, explore the examples or dive into the source — all utilities are documented via **TSDoc** and typed properly.
|
|
152
156
|
|
|
153
157
|
```ts
|
|
154
|
-
import {
|
|
155
|
-
import {
|
|
156
|
-
import {
|
|
157
|
-
import {
|
|
158
|
-
import {
|
|
159
|
-
import {
|
|
160
|
-
import {
|
|
161
|
-
import {
|
|
162
|
-
import {
|
|
163
|
-
import {
|
|
164
|
-
import {
|
|
165
|
-
import {
|
|
166
|
-
import {
|
|
167
|
-
import {
|
|
158
|
+
import { /* … */ } from "@rzl-zone/utils-js/assertions";
|
|
159
|
+
import { /* … */ } from "@rzl-zone/utils-js/conversions";
|
|
160
|
+
import { /* … */ } from "@rzl-zone/utils-js/events";
|
|
161
|
+
import { /* … */ } from "@rzl-zone/utils-js/formatters";
|
|
162
|
+
import { /* … */ } from "@rzl-zone/utils-js/generators";
|
|
163
|
+
import { /* … */ } from "@rzl-zone/utils-js/next";
|
|
164
|
+
import { /* … */ } from "@rzl-zone/utils-js/next/server";
|
|
165
|
+
import { /* … */ } from "@rzl-zone/utils-js/operations";
|
|
166
|
+
import { /* … */ } from "@rzl-zone/utils-js/parsers";
|
|
167
|
+
import { /* … */ } from "@rzl-zone/utils-js/predicates";
|
|
168
|
+
import { /* … */ } from "@rzl-zone/utils-js/promises";
|
|
169
|
+
import { /* … */ } from "@rzl-zone/utils-js/strings";
|
|
170
|
+
import { /* … */ } from "@rzl-zone/utils-js/tailwind";
|
|
171
|
+
import { /* … */ } from "@rzl-zone/utils-js/urls";
|
|
168
172
|
```
|
|
169
|
-
#### Place your cursor inside { } or after "@rzl-zone/utils-js/{{ | }}" then press Ctrl+Space to see all available functions/types with full TSDoc hints.
|
|
170
173
|
|
|
171
|
-
|
|
174
|
+
#### Place your cursor inside `{ }` or right after the package path `@rzl-zone/utils-js/<put-cursor-here>`, then press Ctrl+Space (Windows/Linux) or Cmd+Space (macOS), or use your editor’s autocomplete shortcut, to see all available functions and types with full TSDoc hints.
|
|
175
|
+
|
|
176
|
+
> ***⚠️ Note:*** Starting from version `3.4.0+`, the extra TypeScript types (e.g., `OmitStrict`, `PartialOnly`, etc), have been removed from the package, to use them, you now need to install **[`@rzl-zone/ts-types-plus`](https://www.npmjs.com/package/@rzl-zone/ts-types-plus)** separately.
|
|
172
177
|
|
|
173
178
|
---
|
|
174
179
|
|
|
@@ -178,7 +183,8 @@ pnpm add @rzl-zone/utils-js@latest
|
|
|
178
183
|
</strong>
|
|
179
184
|
</h3>
|
|
180
185
|
|
|
181
|
-
|
|
186
|
+
#### **Including via CDN:**
|
|
187
|
+
|
|
182
188
|
```xml
|
|
183
189
|
<!-- jsDelivr -->
|
|
184
190
|
<script src="https://cdn.jsdelivr.net/npm/@rzl-zone/utils-js@latest"></script>
|
|
@@ -189,6 +195,7 @@ pnpm add @rzl-zone/utils-js@latest
|
|
|
189
195
|
|
|
190
196
|
> ⚠️ **Note:**
|
|
191
197
|
> When using the library via CDN in the browser:
|
|
198
|
+
>
|
|
192
199
|
> - Always include first the \<script\> tag before your own scripts when using the CDN version.
|
|
193
200
|
> - Some Node.js-specific utilities may **not** be available, e.g.:
|
|
194
201
|
> - Category utils of `tailwind`, `next`, `next/server`.
|
|
@@ -196,18 +203,19 @@ pnpm add @rzl-zone/utils-js@latest
|
|
|
196
203
|
> - The global object provided is `RzlUtilsJs`.
|
|
197
204
|
> - The CDN bundle is **~350KB minified**, for production, consider using bundlers or npm packages for smaller size and tree-shaking.
|
|
198
205
|
|
|
199
|
-
|
|
200
|
-
<h3 id="detailed-features--hint-autocomplete-setup">
|
|
201
|
-
<strong>
|
|
202
|
-
Hint: Autocomplete Setup (Step by Step).
|
|
203
|
-
</strong>
|
|
204
|
-
</h3>
|
|
206
|
+
---
|
|
205
207
|
|
|
206
|
-
|
|
208
|
+
<h3 id="detailed-features--hint-autocomplete-setup">
|
|
209
|
+
<strong>
|
|
210
|
+
Hint: Autocomplete Setup (Step by Step).
|
|
211
|
+
</strong>
|
|
212
|
+
</h3>
|
|
207
213
|
|
|
208
|
-
|
|
214
|
+
#### Make TypeScript & VSCode automatically provide autocomplete for `@rzl-zone/utils-js` without needing triple-slash references in every file:
|
|
209
215
|
|
|
210
|
-
|
|
216
|
+
- 1️⃣ **Install @rzl-zone/utils-js.**
|
|
217
|
+
|
|
218
|
+
- Make sure the package is installed:
|
|
211
219
|
|
|
212
220
|
```bash
|
|
213
221
|
npm install @rzl-zone/utils-js@latest
|
|
@@ -217,9 +225,9 @@ pnpm add @rzl-zone/utils-js@latest
|
|
|
217
225
|
pnpm add @rzl-zone/utils-js@latest
|
|
218
226
|
```
|
|
219
227
|
|
|
220
|
-
|
|
228
|
+
- 2️⃣ **Create a types folder.**
|
|
221
229
|
|
|
222
|
-
|
|
230
|
+
- Inside your project root, make a folder called `types`:
|
|
223
231
|
|
|
224
232
|
```pgsql
|
|
225
233
|
project-root/
|
|
@@ -230,16 +238,16 @@ pnpm add @rzl-zone/utils-js@latest
|
|
|
230
238
|
└─ jsconfig.json
|
|
231
239
|
```
|
|
232
240
|
|
|
233
|
-
|
|
241
|
+
- 3️⃣ **Add the global reference file.**
|
|
234
242
|
|
|
235
|
-
|
|
243
|
+
- Create `types/index.d.ts` with this content:
|
|
236
244
|
|
|
237
245
|
```ts
|
|
238
246
|
/// <reference types="@rzl-zone/utils-js" />
|
|
239
247
|
```
|
|
240
248
|
|
|
241
|
-
|
|
242
|
-
|
|
249
|
+
- This tells TypeScript to include the types from `@rzl-zone/utils-js` globally.
|
|
250
|
+
- You can add more references here if needed, for example:
|
|
243
251
|
|
|
244
252
|
```ts
|
|
245
253
|
/// <reference types="@rzl-zone/utils-js" />
|
|
@@ -247,68 +255,61 @@ pnpm add @rzl-zone/utils-js@latest
|
|
|
247
255
|
// eg more references (if needed):
|
|
248
256
|
/// <reference types="node" />
|
|
249
257
|
/// <reference types="react" />
|
|
250
|
-
```
|
|
258
|
+
```
|
|
251
259
|
|
|
252
|
-
|
|
260
|
+
- 4️⃣ **Update tsconfig.json.**
|
|
253
261
|
|
|
254
|
-
|
|
262
|
+
- Make sure not to override "types" (or leave it empty) so TypeScript automatically picks up your types folder:
|
|
255
263
|
|
|
256
264
|
```jsonc
|
|
257
265
|
// tsconfig.json
|
|
258
266
|
{
|
|
259
267
|
"compilerOptions": {
|
|
260
268
|
"strict": true,
|
|
261
|
-
"typeRoots": [
|
|
269
|
+
"typeRoots": [
|
|
270
|
+
"./types",
|
|
271
|
+
"./node_modules/@types"
|
|
272
|
+
],
|
|
262
273
|
// other your config...
|
|
263
274
|
},
|
|
264
|
-
"include": [
|
|
275
|
+
"include": [
|
|
276
|
+
"src",
|
|
277
|
+
"types"
|
|
278
|
+
],
|
|
265
279
|
// other your config...
|
|
266
280
|
}
|
|
267
281
|
```
|
|
268
|
-
- `typeRoots` tells TS where to look for global type definitions.
|
|
269
|
-
- The `types` folder comes first, so your references override or add to the default `@types` packages
|
|
270
282
|
|
|
271
|
-
|
|
283
|
+
- `typeRoots` tells TS where to look for global type definitions.
|
|
284
|
+
- The `types` folder comes first, so your references override or add to the default `@types` packages.
|
|
272
285
|
|
|
273
|
-
|
|
286
|
+
- 5️⃣ **Update jsconfig.json (for JavaScript projects).**
|
|
287
|
+
|
|
288
|
+
- If you also work with JS, do the same:
|
|
274
289
|
|
|
275
290
|
```jsonc
|
|
276
291
|
// jsconfig.json
|
|
277
292
|
{
|
|
278
293
|
"compilerOptions": {
|
|
279
294
|
"checkJs": true, // Optional, enables type checking
|
|
280
|
-
"typeRoots": [
|
|
295
|
+
"typeRoots": [
|
|
296
|
+
"./types",
|
|
297
|
+
"./node_modules/@types"
|
|
298
|
+
],
|
|
281
299
|
// other your config...
|
|
282
300
|
},
|
|
283
|
-
"include": [
|
|
301
|
+
"include": [
|
|
302
|
+
"src",
|
|
303
|
+
"types"
|
|
304
|
+
],
|
|
284
305
|
// other your config...
|
|
285
306
|
}
|
|
286
307
|
```
|
|
308
|
+
|
|
287
309
|
>ℹ️ ***Tip:*** *For JS projects, consider adding "checkJs": true for better IntelliSense.*
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
<!-- - <h4 id="detailed-features--assertions">
|
|
292
|
-
Assertions -
|
|
293
|
-
<a href="/docs/detailed-features/assertions.md#docs-sub-main--title">
|
|
294
|
-
Read More Docs.
|
|
295
|
-
</a>
|
|
296
|
-
</h4>
|
|
297
|
-
|
|
298
|
-
- <h4 id="detailed-features--checkers">
|
|
299
|
-
Checkers -
|
|
300
|
-
<a href="/docs/detailed-features/checkers.md#docs-sub-main--title">
|
|
301
|
-
Read More Docs.
|
|
302
|
-
</a>
|
|
303
|
-
</h4>
|
|
304
|
-
|
|
305
|
-
- <h4 id="detailed-features--conversions">
|
|
306
|
-
Conversions -
|
|
307
|
-
<a href="/docs/detailed-features/conversions/index.md#conversions-lists">
|
|
308
|
-
Read More Docs.
|
|
309
|
-
</a>
|
|
310
|
-
</h4>
|
|
311
|
-
-->
|
|
310
|
+
|
|
311
|
+
#### **Now, all types from `@rzl-zone/utils-js` are globally available, and you don’t need `"types": ["@rzl-zone/utils-js"]` in tsconfig.json.**
|
|
312
|
+
|
|
312
313
|
---
|
|
313
314
|
|
|
314
315
|
<h2 id="usage">🔥 <strong>Usage</strong></h2>
|
|
@@ -328,7 +329,7 @@ console.log(isServer());
|
|
|
328
329
|
|
|
329
330
|
<h2 id="sponsor-this-package">❤️ <strong>Sponsor this package</strong></h2>
|
|
330
331
|
|
|
331
|
-
**Help support development:**
|
|
332
|
+
**Help support development:**
|
|
332
333
|
*[👉 **Become a sponsor**](https://github.com/sponsors/rzl-app).*
|
|
333
334
|
|
|
334
335
|
---
|
|
@@ -360,12 +361,13 @@ console.log(isServer());
|
|
|
360
361
|
|
|
361
362
|
<h2 id="license">📜 <strong>License</strong></h2>
|
|
362
363
|
|
|
363
|
-
**The MIT License (MIT).**
|
|
364
|
+
**The MIT License (MIT).**
|
|
364
365
|
*Please see **[License File](LICENSE.md)** for more information.*
|
|
365
366
|
|
|
366
367
|
---
|
|
367
368
|
|
|
368
|
-
|
|
369
|
+
<h2>✅ <strong>Enjoy using <code>@rzl-zone/utils-js</code>?</strong></h2>
|
|
370
|
+
|
|
369
371
|
*Star this repo [⭐](https://github.com/rzl-zone/utils-js) and share it with other JavaScript developers!*
|
|
370
372
|
|
|
371
373
|
---
|
|
@@ -2,40 +2,40 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.11.1.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
|
9
9
|
*/
|
|
10
10
|
'use strict';
|
|
11
11
|
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
var
|
|
12
|
+
var chunkB6PMNZ4M_cjs = require('../chunk-B6PMNZ4M.cjs');
|
|
13
|
+
var chunkWXFTVXBF_cjs = require('../chunk-WXFTVXBF.cjs');
|
|
14
|
+
var chunkDLS3G6WQ_cjs = require('../chunk-DLS3G6WQ.cjs');
|
|
15
15
|
require('../chunk-UDA26MCU.cjs');
|
|
16
|
-
var
|
|
16
|
+
var chunkSYHPSOUU_cjs = require('../chunk-SYHPSOUU.cjs');
|
|
17
17
|
|
|
18
18
|
Object.defineProperty(exports, "assertIsBigInt", {
|
|
19
19
|
enumerable: true,
|
|
20
|
-
get: function () { return
|
|
20
|
+
get: function () { return chunkB6PMNZ4M_cjs.assertIsBigInt; }
|
|
21
21
|
});
|
|
22
22
|
Object.defineProperty(exports, "assertIsNumber", {
|
|
23
23
|
enumerable: true,
|
|
24
|
-
get: function () { return
|
|
24
|
+
get: function () { return chunkB6PMNZ4M_cjs.assertIsNumber; }
|
|
25
25
|
});
|
|
26
26
|
Object.defineProperty(exports, "assertIsString", {
|
|
27
27
|
enumerable: true,
|
|
28
|
-
get: function () { return
|
|
28
|
+
get: function () { return chunkWXFTVXBF_cjs.assertIsString; }
|
|
29
29
|
});
|
|
30
30
|
Object.defineProperty(exports, "assertIsArray", {
|
|
31
31
|
enumerable: true,
|
|
32
|
-
get: function () { return
|
|
32
|
+
get: function () { return chunkDLS3G6WQ_cjs.assertIsArray; }
|
|
33
33
|
});
|
|
34
34
|
Object.defineProperty(exports, "assertIsBoolean", {
|
|
35
35
|
enumerable: true,
|
|
36
|
-
get: function () { return
|
|
36
|
+
get: function () { return chunkSYHPSOUU_cjs.assertIsBoolean; }
|
|
37
37
|
});
|
|
38
38
|
Object.defineProperty(exports, "assertIsPlainObject", {
|
|
39
39
|
enumerable: true,
|
|
40
|
-
get: function () { return
|
|
40
|
+
get: function () { return chunkSYHPSOUU_cjs.assertIsPlainObject; }
|
|
41
41
|
});
|