@rzl-zone/utils-js 3.5.7 → 3.7.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.
Files changed (119) hide show
  1. package/README.md +1 -1
  2. package/dist/assertions/index.cjs +1 -1
  3. package/dist/assertions/index.d.ts +1 -1
  4. package/dist/assertions/index.js +1 -1
  5. package/dist/chunk-2CQI36UD.cjs +1 -1
  6. package/dist/chunk-2VO2CBTU.js +1 -1
  7. package/dist/chunk-3KTD3QDI.js +1 -1
  8. package/dist/{chunk-RS5RBLPB.js → chunk-3LEWQV3R.js} +46 -8
  9. package/dist/chunk-4ACKNPL5.js +1 -1
  10. package/dist/chunk-4ZOXSUXB.js +1 -1
  11. package/dist/chunk-5NN4ZDE2.cjs +1 -1
  12. package/dist/chunk-66WLOZOD.cjs +1 -1
  13. package/dist/{chunk-6DSPJA5U.js → chunk-6PKW4WCT.js} +2 -2
  14. package/dist/chunk-6RFNZ2ZZ.cjs +1 -1
  15. package/dist/chunk-6WMB5AJR.js +1 -1
  16. package/dist/chunk-7QQV66RX.cjs +1 -1
  17. package/dist/chunk-7WBMA2VE.cjs +1 -1
  18. package/dist/chunk-7ZNEUWYP.js +1 -1
  19. package/dist/chunk-A3YI6Y2P.js +1 -1
  20. package/dist/chunk-ABA2ZSBQ.js +1 -1
  21. package/dist/chunk-AKKM6MOX.cjs +1 -1
  22. package/dist/chunk-ATLFMKAF.cjs +1 -1
  23. package/dist/chunk-B4SDEBN7.cjs +1 -1
  24. package/dist/chunk-B6UIKBHR.cjs +1 -1
  25. package/dist/chunk-BAV5T2E3.cjs +1 -1
  26. package/dist/chunk-BG3AS5BU.cjs +173 -0
  27. package/dist/chunk-BYUT376O.cjs +1 -1
  28. package/dist/{chunk-RIEYB2AW.cjs → chunk-CKUEZF4R.cjs} +1 -1
  29. package/dist/chunk-D53CE4BT.js +1 -1
  30. package/dist/chunk-DPLL67OT.js +1 -1
  31. package/dist/chunk-DVMHRLKP.cjs +1 -1
  32. package/dist/chunk-EK7FSI7F.cjs +1 -1
  33. package/dist/chunk-F3WBQKRI.cjs +1 -1
  34. package/dist/chunk-FI76UZRF.js +1 -1
  35. package/dist/chunk-GAJBF6DR.js +1 -1
  36. package/dist/chunk-JY4HLZ4W.js +1 -1
  37. package/dist/chunk-K3SONK25.cjs +1 -1
  38. package/dist/chunk-K63WO3XA.cjs +1 -1
  39. package/dist/chunk-KHO2SBNA.cjs +1 -1
  40. package/dist/{chunk-TPYENEQ4.cjs → chunk-KIYALQQF.cjs} +44 -9
  41. package/dist/chunk-KPCDDYTZ.js +1 -1
  42. package/dist/chunk-KTQLDIIT.cjs +1 -1
  43. package/dist/chunk-L5RDAVVH.js +1 -1
  44. package/dist/chunk-LEX4TQW2.js +1 -1
  45. package/dist/chunk-LIU4S3JA.cjs +1 -1
  46. package/dist/chunk-NREACG6M.cjs +1 -1
  47. package/dist/chunk-OFBFGFVH.js +1 -1
  48. package/dist/chunk-ONZFBJVW.js +1 -1
  49. package/dist/chunk-OS5OT5JA.cjs +1 -1
  50. package/dist/chunk-PZQC3FZY.js +1 -1
  51. package/dist/chunk-QAPYHLHC.cjs +1 -1
  52. package/dist/chunk-QNKGP5DY.js +1 -1
  53. package/dist/chunk-QUITZ3GP.js +1 -1
  54. package/dist/{chunk-H5NWBTHW.cjs → chunk-R3PBF6F7.cjs} +11 -11
  55. package/dist/chunk-RMJC3B5P.cjs +1 -1
  56. package/dist/chunk-SZJ7OI4S.js +1 -1
  57. package/dist/chunk-TDPYR5JY.js +1 -1
  58. package/dist/chunk-TDYGYHSH.js +1 -1
  59. package/dist/chunk-TFDXRT6D.cjs +1 -1
  60. package/dist/{chunk-SN6YRDLG.js → chunk-U5VR4TJN.js} +1 -1
  61. package/dist/chunk-UDA26MCU.cjs +1 -1
  62. package/dist/chunk-UKAUXY2U.cjs +1 -1
  63. package/dist/chunk-VCVND6CH.js +1 -1
  64. package/dist/chunk-VJDDGRIK.cjs +1 -1
  65. package/dist/chunk-VJVCXEH7.cjs +1997 -0
  66. package/dist/chunk-VNADVWSJ.js +1 -1
  67. package/dist/chunk-WNO3EPYT.js +170 -0
  68. package/dist/chunk-WVSPXFTY.js +1 -1
  69. package/dist/chunk-XFTUHS4Y.js +1 -1
  70. package/dist/chunk-YC7AK3KX.cjs +1 -1
  71. package/dist/chunk-YGB2BQPB.cjs +1 -1
  72. package/dist/chunk-YS27V6LS.js +1994 -0
  73. package/dist/chunk-YWHHVDT4.js +1 -1
  74. package/dist/chunk-ZN53RM3R.js +1 -1
  75. package/dist/conversions/index.cjs +1 -1
  76. package/dist/conversions/index.d.ts +1 -1
  77. package/dist/conversions/index.js +1 -1
  78. package/dist/events/index.cjs +1 -1
  79. package/dist/events/index.d.ts +1 -1
  80. package/dist/events/index.js +1 -1
  81. package/dist/formatters/index.cjs +1 -1
  82. package/dist/formatters/index.d.ts +1 -1
  83. package/dist/formatters/index.js +1 -1
  84. package/dist/generators/index.cjs +1 -1
  85. package/dist/generators/index.d.ts +1 -1
  86. package/dist/generators/index.js +1 -1
  87. package/dist/index.d.ts +1 -1
  88. package/dist/isPlainObject-FWmcJF6k.d.ts +1 -1
  89. package/dist/next/index.cjs +9 -8
  90. package/dist/next/index.d.ts +1 -1
  91. package/dist/next/index.js +3 -2
  92. package/dist/next/server/index.cjs +1 -1
  93. package/dist/next/server/index.d.ts +1 -1
  94. package/dist/next/server/index.js +1 -1
  95. package/dist/operations/index.cjs +1 -1
  96. package/dist/operations/index.d.ts +1 -1
  97. package/dist/operations/index.js +1 -1
  98. package/dist/parsers/index.cjs +1 -1
  99. package/dist/parsers/index.d.ts +1 -1
  100. package/dist/parsers/index.js +1 -1
  101. package/dist/predicates/index.cjs +33 -28
  102. package/dist/predicates/index.d.ts +142 -2
  103. package/dist/predicates/index.js +3 -2
  104. package/dist/promises/index.cjs +1 -1
  105. package/dist/promises/index.d.ts +1 -1
  106. package/dist/promises/index.js +1 -1
  107. package/dist/rzl-utils.global.js +2 -2
  108. package/dist/strings/index.cjs +1 -1
  109. package/dist/strings/index.d.ts +1 -1
  110. package/dist/strings/index.js +1 -1
  111. package/dist/tailwind/index.cjs +13 -9
  112. package/dist/tailwind/index.d.ts +124 -19
  113. package/dist/tailwind/index.js +2 -2
  114. package/dist/urls/index.cjs +14 -9
  115. package/dist/urls/index.d.ts +268 -19
  116. package/dist/urls/index.js +4 -3
  117. package/package.json +11 -3
  118. package/dist/chunk-LBNOZIZ6.js +0 -90
  119. package/dist/chunk-URDI3IMY.cjs +0 -93
@@ -2,7 +2,7 @@
2
2
  * ====================================================
3
3
  * Rzl Utils-JS.
4
4
  * ----------------------------------------------------
5
- * Version: 3.5.7.
5
+ * Version: 3.7.0.
6
6
  * Author: Rizalvin Dwiky.
7
7
  * Repository: https://github.com/rzl-zone/utils-js.
8
8
  * ====================================================
@@ -2131,6 +2131,146 @@ declare const isURL:(value:unknown)=>value is URL;
2131
2131
  * isUndefined("abc"); // ➔ false
2132
2132
  */
2133
2133
  declare const isUndefined:(value:unknown)=>value is undefined;
2134
+ /** ---------------------------------------------------------
2135
+ * * ***Options for `isValidDomain` predicate.***
2136
+ * ---------------------------------------------------------
2137
+ * **Customize the behavior of domain validation.**
2138
+ */
2139
+ type IsValidDomainOptions={
2140
+ /** * ***Enable conversion of Unicode domains (IDN) to ASCII (punycode).***
2141
+ *
2142
+ * - Example: `"пример.рф"` ➔ `"xn--e1afmkfd.xn--p1ai"`
2143
+ * - Allows validating Unicode domains correctly.
2144
+ * - Default: `false`
2145
+ *
2146
+ * @defaultValue `false`.
2147
+ */
2148
+ allowUnicode?:boolean;
2149
+ /** * ***If `true`, validates **only top-level domains (TLDs)** that are not part of any SLD/second-level domain.***
2150
+ *
2151
+ * - Accepts country-code TLDs like `"ai"` or `"ai."` ✅
2152
+ * - Rejects common TLDs that are part of SLDs like `"com"` ❌
2153
+ * - Only the final label is checked; subdomains are ignored.
2154
+ * - Default: `false`
2155
+ *
2156
+ * @defaultValue `false`.
2157
+ */
2158
+ topLevel?:boolean;
2159
+ /** * ***Allow or disallow subdomains.***
2160
+ *
2161
+ * - Example: `"sub.example.com"` ✅ if `subdomain` is `true`, ❌ if `false`
2162
+ * - Wildcards and SLDs are considered when evaluating subdomains.
2163
+ * - Default: `true`
2164
+ *
2165
+ * @defaultValue `true`.
2166
+ */
2167
+ subdomain?:boolean;
2168
+ /** * ***Allow a wildcard `*` in the left-most label.***
2169
+ *
2170
+ * - Example: `"*.example.com"` ✅ if `wildcard` is `true`, ❌ if `false`
2171
+ * - Wildcards are only valid in the first label and require at least one additional label.
2172
+ * - Default: `false`
2173
+ *
2174
+ * @defaultValue `false`.
2175
+ */
2176
+ wildcard?:boolean;
2177
+ /** * ***Allow a port after the domain.***
2178
+ *
2179
+ * - Example: `"localhost:3000"` or `"example.com:8080"` ✅ if `allowPort` is `true`
2180
+ * - Validates that the port is a number between `1` and `65535`.
2181
+ * - Does not affect domain validation rules otherwise.
2182
+ * - Default: `false`
2183
+ *
2184
+ * @defaultValue `false`.
2185
+ */
2186
+ allowPort?:boolean;
2187
+ /** * ***Allow special domains like `localhost`.***
2188
+ *
2189
+ * - Example: `"localhost"` ✅ if `allowLocalhost` is `true`
2190
+ * - Works with or without a port if `allowPort` is enabled.
2191
+ * - Default: `false`
2192
+ *
2193
+ * @defaultValue `false`.
2194
+ */
2195
+ allowLocalhost?:boolean;
2196
+ /** * ***Allow URLs with protocol (`http`/`https`) and automatically extract the hostname.***
2197
+ *
2198
+ * - Example: `"https://example.com/foo/bar"` ➔ `"example.com"`
2199
+ * - The function will validate only the hostname part and ignore the path, query, and fragment.
2200
+ * - Default: `false`
2201
+ *
2202
+ * @defaultValue `false`.
2203
+ */
2204
+ allowProtocol?:boolean;};
2205
+ /** ---------------------------------------------------------
2206
+ * * ***Predicate: `isValidDomain`.***
2207
+ * ---------------------------------------------------------
2208
+ * **Validates whether a given string is a properly formatted domain name.**
2209
+ *
2210
+ * - **Supports options for:**
2211
+ * - `allowUnicode` ➔ allows internationalized domain names (IDN) with Unicode characters.
2212
+ * - `topLevel` ➔ validates **only top-level domains (TLDs)**; ignores subdomains and SLDs.
2213
+ * - `subdomain` ➔ allows or disallows subdomains.
2214
+ * - `wildcard` ➔ allows wildcard (`*`) in the left-most label.
2215
+ * - `allowPort` ➔ allows a port number after the domain (e.g., `example.com:8080`).
2216
+ * - `allowLocalhost` ➔ allows the special domain `"localhost"`.
2217
+ * - `allowProtocol` ➔ allows a URL with protocol (`http`/`https`) and extracts the hostname.
2218
+ *
2219
+ * - **Behavior:**
2220
+ * - ✅ Converts Unicode to ASCII (punycode) if `allowUnicode` is `true`.
2221
+ * - ✅ Checks label lengths (≤63 chars), valid characters, and punycode consistency.
2222
+ * - ✅ Validates port if `allowPort` is `true` (must be 1–65535).
2223
+ * - ✅ Accepts `"localhost"` if `allowLocalhost` is `true`.
2224
+ * - ✅ Extracts hostname from URLs if `allowProtocol` is `true`.
2225
+ * - ❌ Rejects invalid domains, labels starting/ending with `-`, double dots, malformed TLDs, or invalid port numbers.
2226
+ * - ✅ Handles both standard domains (example.com), URLs with protocols (https://example.com/foo), and IDNs (пример.рф).
2227
+ *
2228
+ * @param {*} value - The value to validate; only strings are valid domains.
2229
+ * @param {IsValidDomainOptions} [options] - Optional configuration for domain validation.
2230
+ * @param {boolean} [options.allowUnicode=false] - Enable punycode conversion for Unicode domains.
2231
+ * @param {boolean} [options.topLevel=false] - Validate only TLDs (e.g., `ai`, `uk.`); ignores SLDs like `com`.
2232
+ * @param {boolean} [options.subdomain=true] - Allow subdomains; set `false` to reject any subdomain.
2233
+ * @param {boolean} [options.wildcard=false] - Allow wildcard `*` in the left-most label (e.g., `*.example.com`).
2234
+ * @param {boolean} [options.allowPort=false] - Allow port number after domain (e.g., `:3000`); must be 1–65535.
2235
+ * @param {boolean} [options.allowLocalhost=false] - Allow special domain `"localhost"`.
2236
+ * @param {boolean} [options.allowProtocol=false] - Allow URLs with protocol (`http`/`https`) and extract hostname only.
2237
+ * @returns {boolean} Returns `true` if the value is a valid domain according to the rules and options; otherwise `false`.
2238
+ *
2239
+ * @example
2240
+ * isValidDomain("google.com");
2241
+ * // ➔ true
2242
+ *
2243
+ * isValidDomain("пример.рф", { allowUnicode: true });
2244
+ * // ➔ true
2245
+ *
2246
+ * isValidDomain("sub.example.com", { subdomain: false });
2247
+ * // ➔ false
2248
+ *
2249
+ * isValidDomain("*.example.com", { wildcard: true });
2250
+ * // ➔ true
2251
+ *
2252
+ * isValidDomain("com", { topLevel: true });
2253
+ * // ➔ false (common TLD rejected because it's part of SLD)
2254
+ *
2255
+ * isValidDomain("ai.", { topLevel: true });
2256
+ * // ➔ true (country-code TLD accepted)
2257
+ *
2258
+ * isValidDomain("localhost", { allowLocalhost: true });
2259
+ * // ➔ true
2260
+ *
2261
+ * isValidDomain("localhost:3000", { allowLocalhost: true, allowPort: true });
2262
+ * // ➔ true
2263
+ *
2264
+ * isValidDomain("example.com:8080", { allowPort: true });
2265
+ * // ➔ true
2266
+ *
2267
+ * isValidDomain("https://example.com/foo/bar", { allowProtocol: true });
2268
+ * // ➔ true (protocol stripped and hostname validated)
2269
+ *
2270
+ * isValidDomain("invalid_domain.com");
2271
+ * // ➔ false
2272
+ */
2273
+ declare function isValidDomain(value:unknown,options?:IsValidDomainOptions):boolean;
2134
2274
  /** ---------------------------------------------------------
2135
2275
  * * ***Predicate: `isValidURL`.***
2136
2276
  * ---------------------------------------------------------
@@ -2169,4 +2309,4 @@ declare const isValidURL:(url:unknown)=>boolean;
2169
2309
  * isWeakMap(new Map);
2170
2310
  * // ➔ false
2171
2311
  */
2172
- declare function isWeakMap<K extends object=object,V=unknown>(value:unknown):value is WeakMap<K,V>;export{type IsArrayResult,IsPlainObjectResult,areArraysEqual,areObjectsEqual,areURLsEqualPath,areURLsIdentical,arrayHasAnyMatch,doesKeyExist,hasOwnProp,isArguments,isArray,isArrayBuffer,isArrayLike,isArrayLikeObject,isBigInt,isBoolean,isBooleanObject,isBuffer,isCurrencyLike,isDate,isDeepEqual,isElement,isEmpty,isEmptyArray,isEmptyDeep,isEmptyObject,isEmptyString,isEmptyValue,isEqual,isEqualWith,isError,isFinite,isFunction,isInfinityNumber,isInteger,isLength,isMap,isMatch,isMatchWith,isNaN,isNative,isNil,isNonEmptyArray,isNonEmptyString,isNonEmptyValue,isNull,isNumberObject,isObject,isObjectLoose,isObjectOrArray,isPropertyKey,isRegExp,isSafeInteger,isServer,isSet,isString,isStringObject,isSymbol,isTypedArray,isURL,isUndefined,isValidURL,isWeakMap,textContainsAll,textContainsAny};
2312
+ declare function isWeakMap<K extends object=object,V=unknown>(value:unknown):value is WeakMap<K,V>;export{type IsArrayResult,IsPlainObjectResult,areArraysEqual,areObjectsEqual,areURLsEqualPath,areURLsIdentical,arrayHasAnyMatch,doesKeyExist,hasOwnProp,isArguments,isArray,isArrayBuffer,isArrayLike,isArrayLikeObject,isBigInt,isBoolean,isBooleanObject,isBuffer,isCurrencyLike,isDate,isDeepEqual,isElement,isEmpty,isEmptyArray,isEmptyDeep,isEmptyObject,isEmptyString,isEmptyValue,isEqual,isEqualWith,isError,isFinite,isFunction,isInfinityNumber,isInteger,isLength,isMap,isMatch,isMatchWith,isNaN,isNative,isNil,isNonEmptyArray,isNonEmptyString,isNonEmptyValue,isNull,isNumberObject,isObject,isObjectLoose,isObjectOrArray,isPropertyKey,isRegExp,isSafeInteger,isServer,isSet,isString,isStringObject,isSymbol,isTypedArray,isURL,isUndefined,isValidDomain,isValidURL,isWeakMap,textContainsAll,textContainsAny};
@@ -2,12 +2,12 @@
2
2
  * ====================================================
3
3
  * Rzl Utils-JS.
4
4
  * ----------------------------------------------------
5
- * Version: 3.5.7.
5
+ * Version: 3.7.0.
6
6
  * Author: Rizalvin Dwiky.
7
7
  * Repository: https://github.com/rzl-zone/utils-js.
8
8
  * ====================================================
9
9
  */
10
- export { areArraysEqual, areObjectsEqual, areURLsEqualPath, areURLsIdentical, arrayHasAnyMatch, doesKeyExist, isArguments, isArrayLike, isArrayLikeObject, isCurrencyLike, isDeepEqual, isElement, isEmpty, isEmptyDeep, isEqualWith, isLength, isMatch, isMatchWith, isNative, isObjectLoose, isPropertyKey, isSafeInteger, isValidURL, isWeakMap, textContainsAll, textContainsAny } from '../chunk-SN6YRDLG.js';
10
+ export { areArraysEqual, areObjectsEqual, areURLsEqualPath, areURLsIdentical, arrayHasAnyMatch, doesKeyExist, isArguments, isArrayLike, isArrayLikeObject, isCurrencyLike, isDeepEqual, isElement, isEmpty, isEmptyDeep, isEqualWith, isLength, isMatch, isMatchWith, isNative, isObjectLoose, isPropertyKey, isSafeInteger, isValidURL, isWeakMap, textContainsAll, textContainsAny } from '../chunk-U5VR4TJN.js';
11
11
  export { isURL } from '../chunk-ONZFBJVW.js';
12
12
  export { isNonEmptyValue, isTypedArray } from '../chunk-ZN53RM3R.js';
13
13
  export { isEmptyValue } from '../chunk-PZQC3FZY.js';
@@ -15,6 +15,7 @@ export { isServer } from '../chunk-L5RDAVVH.js';
15
15
  import '../chunk-DPLL67OT.js';
16
16
  export { isFinite } from '../chunk-7ZNEUWYP.js';
17
17
  export { isInteger } from '../chunk-WVSPXFTY.js';
18
+ export { isValidDomain } from '../chunk-YS27V6LS.js';
18
19
  export { isEmptyString } from '../chunk-JY4HLZ4W.js';
19
20
  import '../chunk-FI76UZRF.js';
20
21
  export { isArrayBuffer, isEqual, isRegExp } from '../chunk-SZJ7OI4S.js';
@@ -2,7 +2,7 @@
2
2
  * ====================================================
3
3
  * Rzl Utils-JS.
4
4
  * ----------------------------------------------------
5
- * Version: 3.5.7.
5
+ * Version: 3.7.0.
6
6
  * Author: Rizalvin Dwiky.
7
7
  * Repository: https://github.com/rzl-zone/utils-js.
8
8
  * ====================================================
@@ -2,7 +2,7 @@
2
2
  * ====================================================
3
3
  * Rzl Utils-JS.
4
4
  * ----------------------------------------------------
5
- * Version: 3.5.7.
5
+ * Version: 3.7.0.
6
6
  * Author: Rizalvin Dwiky.
7
7
  * Repository: https://github.com/rzl-zone/utils-js.
8
8
  * ====================================================
@@ -2,7 +2,7 @@
2
2
  * ====================================================
3
3
  * Rzl Utils-JS.
4
4
  * ----------------------------------------------------
5
- * Version: 3.5.7.
5
+ * Version: 3.7.0.
6
6
  * Author: Rizalvin Dwiky.
7
7
  * Repository: https://github.com/rzl-zone/utils-js.
8
8
  * ====================================================