@rzl-zone/utils-js 3.8.0 → 3.9.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.
Files changed (122) hide show
  1. package/README.md +5 -1
  2. package/dist/assertions/index.cjs +11 -11
  3. package/dist/assertions/index.d.ts +168 -57
  4. package/dist/assertions/index.js +5 -5
  5. package/dist/{chunk-EK7FSI7F.cjs → chunk-2XGQQZ6A.cjs} +3 -3
  6. package/dist/{chunk-YS27V6LS.js → chunk-3LE6NX57.js} +5 -176
  7. package/dist/{chunk-PZQC3FZY.js → chunk-44X74C26.js} +4 -4
  8. package/dist/{chunk-4ACKNPL5.js → chunk-5KDVIEVO.js} +2 -2
  9. package/dist/{chunk-JY4HLZ4W.js → chunk-5O66AUEC.js} +2 -2
  10. package/dist/{chunk-SLP24LUV.js → chunk-5Y6JL47L.js} +3 -3
  11. package/dist/{chunk-ZW3VYES4.cjs → chunk-62FS7WMB.cjs} +31 -31
  12. package/dist/{chunk-VJVCXEH7.cjs → chunk-6AMDHVS2.cjs} +9 -181
  13. package/dist/{chunk-5IKZ3JDV.js → chunk-6WVOUVWD.js} +9 -9
  14. package/dist/{chunk-BYUT376O.cjs → chunk-76ATVDCR.cjs} +3 -3
  15. package/dist/{chunk-F3WBQKRI.cjs → chunk-7C7TQC5J.cjs} +29 -7
  16. package/dist/{chunk-I3IXLEEG.js → chunk-7EIFPHV3.js} +8 -8
  17. package/dist/{chunk-6RFNZ2ZZ.cjs → chunk-7NXFGJJE.cjs} +14 -14
  18. package/dist/{chunk-TFDXRT6D.cjs → chunk-ALRISPTL.cjs} +3 -3
  19. package/dist/chunk-BAV5T2E3.cjs +1 -1
  20. package/dist/{chunk-4ZOXSUXB.js → chunk-C7GC2PFX.js} +3 -3
  21. package/dist/chunk-DVMHRLKP.cjs +1 -1
  22. package/dist/{chunk-KVZ3HL2B.js → chunk-DXPM4NOU.js} +4 -4
  23. package/dist/{chunk-DPLL67OT.js → chunk-EJV5AF4L.js} +2 -2
  24. package/dist/{chunk-NREACG6M.cjs → chunk-FWWPEL7J.cjs} +3 -3
  25. package/dist/{chunk-LEX4TQW2.js → chunk-GHU356XQ.js} +4 -6
  26. package/dist/chunk-GKDSBOYE.js +209 -0
  27. package/dist/{chunk-YC7AK3KX.cjs → chunk-H44QVAZL.cjs} +31 -31
  28. package/dist/{chunk-AKKM6MOX.cjs → chunk-I33PB44Q.cjs} +15 -15
  29. package/dist/{chunk-LIU4S3JA.cjs → chunk-IX6PF5ZP.cjs} +4 -4
  30. package/dist/{chunk-3KTD3QDI.js → chunk-J4TT33ZX.js} +29 -7
  31. package/dist/{chunk-SZJ7OI4S.js → chunk-J6VLFVIL.js} +3 -3
  32. package/dist/{chunk-3JD53UUH.cjs → chunk-JI57K7D4.cjs} +161 -161
  33. package/dist/{chunk-OFBFGFVH.js → chunk-JYOCB6OV.js} +2 -2
  34. package/dist/chunk-KHO2SBNA.cjs +1 -1
  35. package/dist/{chunk-6NORJBI6.cjs → chunk-KUVRZ2JW.cjs} +50 -50
  36. package/dist/chunk-L5RDAVVH.js +1 -1
  37. package/dist/{chunk-VCVND6CH.js → chunk-M5QB2GM5.js} +2 -2
  38. package/dist/{chunk-RRJIRXHS.js → chunk-MBFVTGYS.js} +4 -4
  39. package/dist/{chunk-UKAUXY2U.cjs → chunk-MMRHKYT6.cjs} +12 -12
  40. package/dist/{chunk-U5VR4TJN.js → chunk-MS2KSKD7.js} +9 -9
  41. package/dist/{chunk-7ZNEUWYP.js → chunk-MZ3T6L7Z.js} +2 -2
  42. package/dist/{chunk-ATLFMKAF.cjs → chunk-NAOVH4OH.cjs} +7 -7
  43. package/dist/{chunk-HKJZ7K2K.cjs → chunk-NJ24M6ZH.cjs} +37 -37
  44. package/dist/chunk-OCTHWEZK.cjs +249 -0
  45. package/dist/chunk-ONZFBJVW.js +1 -1
  46. package/dist/{chunk-FI76UZRF.js → chunk-OSSFLQDD.js} +3 -4
  47. package/dist/{chunk-7WBMA2VE.cjs → chunk-OYFUBKEG.cjs} +4 -5
  48. package/dist/{chunk-B4SDEBN7.cjs → chunk-PWKOFPAH.cjs} +3 -3
  49. package/dist/{chunk-RJYWBVGD.cjs → chunk-QGTFQ7RO.cjs} +6 -6
  50. package/dist/chunk-QNKGP5DY.js +1 -1
  51. package/dist/chunk-QXTJVDWE.js +676 -0
  52. package/dist/{chunk-B6UIKBHR.cjs → chunk-QZI5PVCI.cjs} +4 -4
  53. package/dist/{chunk-PW2VMJLT.js → chunk-R2DR7SPJ.js} +99 -25
  54. package/dist/{chunk-TDYGYHSH.js → chunk-SN5HAK3Y.js} +4 -4
  55. package/dist/{chunk-P3ST4UZA.js → chunk-SRWL4YCP.js} +7 -7
  56. package/dist/{chunk-7QQV66RX.cjs → chunk-TJ5OY6MC.cjs} +10 -10
  57. package/dist/{chunk-6WMB5AJR.js → chunk-TXOVQZPU.js} +3 -4
  58. package/dist/chunk-UDA26MCU.cjs +1 -1
  59. package/dist/{chunk-LVFTN6DK.cjs → chunk-UFYMRRJH.cjs} +61 -61
  60. package/dist/{chunk-5NN4ZDE2.cjs → chunk-UV5BKAYW.cjs} +6 -8
  61. package/dist/{chunk-GAJBF6DR.js → chunk-UXT4XSUK.js} +2 -2
  62. package/dist/{chunk-6VA4F6VR.js → chunk-VBSLIIDB.js} +10 -10
  63. package/dist/chunk-VCYXNIZ2.cjs +678 -0
  64. package/dist/chunk-VJDDGRIK.cjs +1 -1
  65. package/dist/{chunk-JIROTDOU.js → chunk-WB3FT62A.js} +3 -3
  66. package/dist/{chunk-K63WO3XA.cjs → chunk-WKM6UVMG.cjs} +4 -5
  67. package/dist/{chunk-5PF7KRCP.cjs → chunk-WLEZ2KSG.cjs} +126 -126
  68. package/dist/{chunk-ZN53RM3R.js → chunk-WRGN6UBK.js} +2 -2
  69. package/dist/chunk-WVSPXFTY.js +1 -1
  70. package/dist/{chunk-2VO2CBTU.js → chunk-X6ULJZ3X.js} +2 -2
  71. package/dist/{chunk-CKUEZF4R.cjs → chunk-XYWC4EQ3.cjs} +71 -71
  72. package/dist/{chunk-A3YI6Y2P.js → chunk-YHFRCVTN.js} +3 -3
  73. package/dist/{chunk-A4H7474O.cjs → chunk-YQHJB7KR.cjs} +26 -26
  74. package/dist/{chunk-YGB2BQPB.cjs → chunk-YVRUY4EW.cjs} +8 -8
  75. package/dist/chunk-YWHHVDT4.js +1 -1
  76. package/dist/chunk-ZTHJQJ5F.cjs +211 -0
  77. package/dist/conversions/index.cjs +34 -34
  78. package/dist/conversions/index.d.ts +1 -1
  79. package/dist/conversions/index.js +15 -15
  80. package/dist/events/index.cjs +8 -8
  81. package/dist/events/index.d.ts +1 -1
  82. package/dist/events/index.js +4 -4
  83. package/dist/formatters/index.cjs +19 -19
  84. package/dist/formatters/index.d.ts +1 -1
  85. package/dist/formatters/index.js +9 -9
  86. package/dist/generators/index.cjs +9 -9
  87. package/dist/generators/index.d.ts +1 -1
  88. package/dist/generators/index.js +4 -4
  89. package/dist/index.d.ts +1 -1
  90. package/dist/isPlainObject-BTPjv6zB.d.ts +1 -1
  91. package/dist/next/index.cjs +37 -36
  92. package/dist/next/index.d.ts +1 -1
  93. package/dist/next/index.js +9 -8
  94. package/dist/next/server/index.cjs +4 -4
  95. package/dist/next/server/index.d.ts +1 -1
  96. package/dist/next/server/index.js +2 -2
  97. package/dist/operations/index.cjs +11 -11
  98. package/dist/operations/index.d.ts +1 -1
  99. package/dist/operations/index.js +8 -8
  100. package/dist/parsers/index.cjs +6 -4
  101. package/dist/parsers/index.d.ts +224 -32
  102. package/dist/parsers/index.js +5 -3
  103. package/dist/predicates/index.cjs +77 -76
  104. package/dist/predicates/index.d.ts +1 -1
  105. package/dist/predicates/index.js +14 -13
  106. package/dist/promises/index.cjs +6 -6
  107. package/dist/promises/index.d.ts +2 -3
  108. package/dist/promises/index.js +4 -4
  109. package/dist/rzl-utils.global.js +2 -2
  110. package/dist/strings/index.cjs +23 -23
  111. package/dist/strings/index.d.ts +1 -1
  112. package/dist/strings/index.js +7 -7
  113. package/dist/tailwind/index.cjs +13 -13
  114. package/dist/tailwind/index.d.ts +1 -1
  115. package/dist/tailwind/index.js +5 -5
  116. package/dist/urls/index.cjs +23 -21
  117. package/dist/urls/index.d.ts +182 -114
  118. package/dist/urls/index.js +16 -14
  119. package/package.json +1 -1
  120. package/dist/chunk-KPCDDYTZ.js +0 -417
  121. package/dist/chunk-QAPYHLHC.cjs +0 -419
  122. package/dist/chunk-SGCN4ED4.cjs +0 -175
@@ -2,17 +2,17 @@
2
2
  * ====================================================
3
3
  * Rzl Utils-JS.
4
4
  * ----------------------------------------------------
5
- * Version: 3.8.0.
5
+ * Version: 3.9.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 chunkF3WBQKRI_cjs = require('./chunk-F3WBQKRI.cjs');
12
+ var chunk7C7TQC5J_cjs = require('./chunk-7C7TQC5J.cjs');
13
13
 
14
14
  var normalizeString = (input) => {
15
- return chunkF3WBQKRI_cjs.isNonEmptyString(input) ? input.trim() : "";
15
+ return chunk7C7TQC5J_cjs.isNonEmptyString(input) ? input.trim() : "";
16
16
  };
17
17
 
18
18
  exports.normalizeString = normalizeString;
@@ -2,7 +2,7 @@
2
2
  * ====================================================
3
3
  * Rzl Utils-JS.
4
4
  * ----------------------------------------------------
5
- * Version: 3.8.0.
5
+ * Version: 3.9.1.
6
6
  * Author: Rizalvin Dwiky.
7
7
  * Repository: https://github.com/rzl-zone/utils-js.
8
8
  * ====================================================
@@ -51,12 +51,11 @@ var isNull = (val) => val === null;
51
51
 
52
52
  var assertIsBoolean = (value, options = {}) => {
53
53
  if (isBoolean(value)) return;
54
- const errorMessage = resolveErrorMessageAssertions({
54
+ resolveErrorMessageAssertions({
55
55
  value,
56
56
  options,
57
57
  requiredValidType: "boolean"
58
58
  });
59
- throw new TypeError(errorMessage);
60
59
  };
61
60
 
62
61
  var isNumber = (value, options = {}) => {
@@ -540,25 +539,48 @@ var getPreciseType = (value, options = { formatCase: "toLowerCase" }) => {
540
539
  }
541
540
  return converterHelper(tag, formatCase);
542
541
  };
542
+ var determineErrorTypeAssertion = (type, message) => {
543
+ switch (type) {
544
+ case "Error":
545
+ throw new Error(message);
546
+ case "EvalError":
547
+ throw new EvalError(message);
548
+ case "RangeError":
549
+ throw new RangeError(message);
550
+ case "ReferenceError":
551
+ throw new ReferenceError(message);
552
+ case "SyntaxError":
553
+ throw new SyntaxError(message);
554
+ case "URIError":
555
+ throw new URIError(message);
556
+ case "TypeError":
557
+ throw new TypeError(message);
558
+ default:
559
+ throw new TypeError(message);
560
+ }
561
+ };
543
562
  function resolveErrorMessageAssertions(params) {
544
563
  const { requiredValidType, value, options } = params || {};
545
- const { message, formatCase } = isPlainObject(options) ? options : {};
564
+ const {
565
+ message,
566
+ formatCase,
567
+ errorType = "TypeError"
568
+ } = isPlainObject(options) ? options : {};
546
569
  const validType2 = toKebabCase(requiredValidType);
547
570
  const currentType = getPreciseType(value, { formatCase });
548
571
  const messageFnOptions = { currentType, validType: validType2 };
549
572
  const defaultMessage = `Parameter input (\`value\`) must be of type \`${validType2}\`, but received: \`${currentType}\`.`;
550
573
  const errorMessage = isFunction(message) ? isNonEmptyString(message(messageFnOptions)) ? message(messageFnOptions).trim() : defaultMessage : isNonEmptyString(message) ? message.trim() : defaultMessage;
551
- return errorMessage;
574
+ return determineErrorTypeAssertion(errorType, errorMessage);
552
575
  }
553
576
 
554
577
  function assertIsPlainObject(value, options = {}) {
555
578
  if (isPlainObject(value)) return;
556
- const errorMessage = resolveErrorMessageAssertions({
579
+ resolveErrorMessageAssertions({
557
580
  value,
558
581
  options,
559
582
  requiredValidType: "plain object"
560
583
  });
561
- throw new TypeError(errorMessage);
562
584
  }
563
585
 
564
586
  exports.assertIsBoolean = assertIsBoolean;
@@ -2,19 +2,19 @@
2
2
  * ====================================================
3
3
  * Rzl Utils-JS.
4
4
  * ----------------------------------------------------
5
- * Version: 3.8.0.
5
+ * Version: 3.9.1.
6
6
  * Author: Rizalvin Dwiky.
7
7
  * Repository: https://github.com/rzl-zone/utils-js.
8
8
  * ====================================================
9
9
  */
10
- import { normalizeSpaces } from './chunk-OFBFGFVH.js';
11
- import { parseCurrencyString } from './chunk-DPLL67OT.js';
12
- import { isFinite } from './chunk-7ZNEUWYP.js';
10
+ import { normalizeSpaces } from './chunk-JYOCB6OV.js';
11
+ import { parseCurrencyString } from './chunk-EJV5AF4L.js';
12
+ import { isFinite } from './chunk-MZ3T6L7Z.js';
13
13
  import { isInteger } from './chunk-WVSPXFTY.js';
14
- import { isEmptyString } from './chunk-JY4HLZ4W.js';
15
- import { assertIsString } from './chunk-FI76UZRF.js';
16
- import { safeStableStringify, isDate } from './chunk-2VO2CBTU.js';
17
- import { isString, getPreciseType, assertIsPlainObject, hasOwnProp, isBoolean, isPlainObject, isNaN, isUndefined, isFunction, assertIsBoolean, isNil, isNumber, isNonEmptyString } from './chunk-3KTD3QDI.js';
14
+ import { isEmptyString } from './chunk-5O66AUEC.js';
15
+ import { assertIsString } from './chunk-OSSFLQDD.js';
16
+ import { safeStableStringify, isDate } from './chunk-X6ULJZ3X.js';
17
+ import { isString, getPreciseType, assertIsPlainObject, hasOwnProp, isBoolean, isPlainObject, isNaN, isUndefined, isFunction, assertIsBoolean, isNil, isNumber, isNonEmptyString } from './chunk-J4TT33ZX.js';
18
18
  import { isSupportedCountry, AsYouType } from 'libphonenumber-js/max';
19
19
  import { id, enUS } from 'date-fns/locale';
20
20
  import { parse, format } from 'date-fns';
@@ -2,22 +2,22 @@
2
2
  * ====================================================
3
3
  * Rzl Utils-JS.
4
4
  * ----------------------------------------------------
5
- * Version: 3.8.0.
5
+ * Version: 3.9.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 chunkNREACG6M_cjs = require('./chunk-NREACG6M.cjs');
13
- var chunkF3WBQKRI_cjs = require('./chunk-F3WBQKRI.cjs');
12
+ var chunkFWWPEL7J_cjs = require('./chunk-FWWPEL7J.cjs');
13
+ var chunk7C7TQC5J_cjs = require('./chunk-7C7TQC5J.cjs');
14
14
 
15
15
  var capitalizeFirst = (string, options = {
16
16
  lowerCaseNextRest: true,
17
17
  trim: false
18
18
  }) => {
19
- if (!chunkF3WBQKRI_cjs.isNonEmptyString(string)) return "";
20
- if (!chunkF3WBQKRI_cjs.isPlainObject(options)) {
19
+ if (!chunk7C7TQC5J_cjs.isNonEmptyString(string)) return "";
20
+ if (!chunk7C7TQC5J_cjs.isPlainObject(options)) {
21
21
  options = {};
22
22
  }
23
23
  const lowerCaseNextRest = options.lowerCaseNextRest !== false;
@@ -30,9 +30,9 @@ var capitalizeWords = (value, options = {
30
30
  collapseSpaces: false,
31
31
  trim: false
32
32
  }) => {
33
- if (!chunkF3WBQKRI_cjs.isNonEmptyString(value)) return "";
33
+ if (!chunk7C7TQC5J_cjs.isNonEmptyString(value)) return "";
34
34
  let result = value;
35
- if (!chunkF3WBQKRI_cjs.isPlainObject(options)) {
35
+ if (!chunk7C7TQC5J_cjs.isPlainObject(options)) {
36
36
  options = {};
37
37
  }
38
38
  const collapseSpaces = options.collapseSpaces === true;
@@ -50,10 +50,10 @@ var capitalizeWords = (value, options = {
50
50
  };
51
51
 
52
52
  function stripHtmlTags(input) {
53
- if (!chunkF3WBQKRI_cjs.isString(input)) {
53
+ if (!chunk7C7TQC5J_cjs.isString(input)) {
54
54
  return void 0;
55
55
  }
56
- if (chunkNREACG6M_cjs.isEmptyString(input)) {
56
+ if (chunkFWWPEL7J_cjs.isEmptyString(input)) {
57
57
  return "";
58
58
  }
59
59
  const stripped = input.replace(/<\/?[a-zA-Z][^<>]*\/?>/g, " ").trim();
@@ -62,7 +62,7 @@ function stripHtmlTags(input) {
62
62
  }
63
63
 
64
64
  var getInitialsName = (name) => {
65
- if (!chunkF3WBQKRI_cjs.isNonEmptyString(name)) return "";
65
+ if (!chunk7C7TQC5J_cjs.isNonEmptyString(name)) return "";
66
66
  name = name.replace(/\s+/g, " ").trim();
67
67
  const nameParts = name.split(" ");
68
68
  if (nameParts.length > 1) {
@@ -75,13 +75,13 @@ var getInitialsName = (name) => {
75
75
  };
76
76
 
77
77
  var replaceAt = (index, originalString, replaceTo) => {
78
- if (!chunkF3WBQKRI_cjs.isNumber(index) || !chunkF3WBQKRI_cjs.isString(replaceTo) || !chunkF3WBQKRI_cjs.isString(originalString)) {
78
+ if (!chunk7C7TQC5J_cjs.isNumber(index) || !chunk7C7TQC5J_cjs.isString(replaceTo) || !chunk7C7TQC5J_cjs.isString(originalString)) {
79
79
  throw new TypeError(
80
- `First parameter (\`index\`) must be of type \`number\`, second parameter (\`originalString\`) and third parameter (\`replaceTo\`) must be of type \`string\`, but received: "['index': \`${chunkF3WBQKRI_cjs.getPreciseType(
80
+ `First parameter (\`index\`) must be of type \`number\`, second parameter (\`originalString\`) and third parameter (\`replaceTo\`) must be of type \`string\`, but received: "['index': \`${chunk7C7TQC5J_cjs.getPreciseType(
81
81
  index
82
- )}\`, 'originalString': \`${chunkF3WBQKRI_cjs.getPreciseType(
82
+ )}\`, 'originalString': \`${chunk7C7TQC5J_cjs.getPreciseType(
83
83
  originalString
84
- )}\`, 'replaceTo': \`${chunkF3WBQKRI_cjs.getPreciseType(replaceTo)}\`]".`
84
+ )}\`, 'replaceTo': \`${chunk7C7TQC5J_cjs.getPreciseType(replaceTo)}\`]".`
85
85
  );
86
86
  }
87
87
  if (index < 0 || index >= originalString.length) {
@@ -2,17 +2,17 @@
2
2
  * ====================================================
3
3
  * Rzl Utils-JS.
4
4
  * ----------------------------------------------------
5
- * Version: 3.8.0.
5
+ * Version: 3.9.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 chunkUKAUXY2U_cjs = require('./chunk-UKAUXY2U.cjs');
12
+ var chunkMMRHKYT6_cjs = require('./chunk-MMRHKYT6.cjs');
13
13
 
14
14
  var isNonEmptyValue = (value, options = {}) => {
15
- return !chunkUKAUXY2U_cjs.isEmptyValue(value, options);
15
+ return !chunkMMRHKYT6_cjs.isEmptyValue(value, options);
16
16
  };
17
17
 
18
18
  var typedArrayTags = /* @__PURE__ */ new Set([
@@ -2,7 +2,7 @@
2
2
  * ====================================================
3
3
  * Rzl Utils-JS.
4
4
  * ----------------------------------------------------
5
- * Version: 3.8.0.
5
+ * Version: 3.9.1.
6
6
  * Author: Rizalvin Dwiky.
7
7
  * Repository: https://github.com/rzl-zone/utils-js.
8
8
  * ====================================================
@@ -2,14 +2,14 @@
2
2
  * ====================================================
3
3
  * Rzl Utils-JS.
4
4
  * ----------------------------------------------------
5
- * Version: 3.8.0.
5
+ * Version: 3.9.1.
6
6
  * Author: Rizalvin Dwiky.
7
7
  * Repository: https://github.com/rzl-zone/utils-js.
8
8
  * ====================================================
9
9
  */
10
10
  import { isServer } from './chunk-L5RDAVVH.js';
11
- import { assertIsString } from './chunk-FI76UZRF.js';
12
- import { isPlainObject, hasOwnProp, isNonEmptyString, isNumber } from './chunk-3KTD3QDI.js';
11
+ import { assertIsString } from './chunk-OSSFLQDD.js';
12
+ import { isPlainObject, hasOwnProp, isNonEmptyString, isNumber } from './chunk-J4TT33ZX.js';
13
13
 
14
14
  var disableUserInteraction = (className = "on_processing") => {
15
15
  if (isServer()) return;
@@ -2,7 +2,7 @@
2
2
  * ====================================================
3
3
  * Rzl Utils-JS.
4
4
  * ----------------------------------------------------
5
- * Version: 3.8.0.
5
+ * Version: 3.9.1.
6
6
  * Author: Rizalvin Dwiky.
7
7
  * Repository: https://github.com/rzl-zone/utils-js.
8
8
  * ====================================================
@@ -2,15 +2,15 @@
2
2
  * ====================================================
3
3
  * Rzl Utils-JS.
4
4
  * ----------------------------------------------------
5
- * Version: 3.8.0.
5
+ * Version: 3.9.1.
6
6
  * Author: Rizalvin Dwiky.
7
7
  * Repository: https://github.com/rzl-zone/utils-js.
8
8
  * ====================================================
9
9
  */
10
- import { isEmptyArray, isEmptyObject } from './chunk-VCVND6CH.js';
10
+ import { isEmptyArray, isEmptyObject } from './chunk-M5QB2GM5.js';
11
11
  import { noop } from './chunk-YWHHVDT4.js';
12
- import { safeStableStringify } from './chunk-2VO2CBTU.js';
13
- import { isNonEmptyString, getPreciseType, isNull, isUndefined, isString, isArray, isObject, isNumber, isNaN as isNaN$1, isError, assertIsPlainObject, hasOwnProp, isBoolean, isFunction } from './chunk-3KTD3QDI.js';
12
+ import { safeStableStringify } from './chunk-X6ULJZ3X.js';
13
+ import { isNonEmptyString, getPreciseType, isNull, isUndefined, isString, isArray, isObject, isNumber, isNaN as isNaN$1, isError, assertIsPlainObject, hasOwnProp, isBoolean, isFunction } from './chunk-J4TT33ZX.js';
14
14
 
15
15
  var parseCustomDate = (dateString, format) => {
16
16
  if (!isNonEmptyString(dateString) || !isNonEmptyString(format)) {
@@ -2,12 +2,12 @@
2
2
  * ====================================================
3
3
  * Rzl Utils-JS.
4
4
  * ----------------------------------------------------
5
- * Version: 3.8.0.
5
+ * Version: 3.9.1.
6
6
  * Author: Rizalvin Dwiky.
7
7
  * Repository: https://github.com/rzl-zone/utils-js.
8
8
  * ====================================================
9
9
  */
10
- import { isNonEmptyString } from './chunk-3KTD3QDI.js';
10
+ import { isNonEmptyString } from './chunk-J4TT33ZX.js';
11
11
 
12
12
  var parseCurrencyString = (input) => {
13
13
  if (!isNonEmptyString(input)) return 0;
@@ -2,17 +2,17 @@
2
2
  * ====================================================
3
3
  * Rzl Utils-JS.
4
4
  * ----------------------------------------------------
5
- * Version: 3.8.0.
5
+ * Version: 3.9.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 chunkF3WBQKRI_cjs = require('./chunk-F3WBQKRI.cjs');
12
+ var chunk7C7TQC5J_cjs = require('./chunk-7C7TQC5J.cjs');
13
13
 
14
14
  var isEmptyString = (value, options = {}) => {
15
- return !chunkF3WBQKRI_cjs.isNonEmptyString(value, options);
15
+ return !chunk7C7TQC5J_cjs.isNonEmptyString(value, options);
16
16
  };
17
17
 
18
18
  exports.isEmptyString = isEmptyString;
@@ -2,33 +2,31 @@
2
2
  * ====================================================
3
3
  * Rzl Utils-JS.
4
4
  * ----------------------------------------------------
5
- * Version: 3.8.0.
5
+ * Version: 3.9.1.
6
6
  * Author: Rizalvin Dwiky.
7
7
  * Repository: https://github.com/rzl-zone/utils-js.
8
8
  * ====================================================
9
9
  */
10
10
  import { isBigInt } from './chunk-QNKGP5DY.js';
11
- import { resolveErrorMessageAssertions, hasOwnProp, isNumber } from './chunk-3KTD3QDI.js';
11
+ import { resolveErrorMessageAssertions, hasOwnProp, isNumber } from './chunk-J4TT33ZX.js';
12
12
 
13
13
  var assertIsBigInt = (value, options = {}) => {
14
14
  if (isBigInt(value)) return;
15
- const errorMessage = resolveErrorMessageAssertions({
15
+ resolveErrorMessageAssertions({
16
16
  value,
17
17
  options,
18
18
  requiredValidType: "big int"
19
19
  });
20
- throw new TypeError(errorMessage);
21
20
  };
22
21
 
23
22
  var assertIsNumber = (value, options = {}) => {
24
23
  const includeNaN = hasOwnProp(options, "includeNaN") ? options.includeNaN : void 0;
25
24
  if (isNumber(value, { includeNaN })) return;
26
- const errorMessage = resolveErrorMessageAssertions({
25
+ resolveErrorMessageAssertions({
27
26
  value,
28
27
  options,
29
28
  requiredValidType: "number"
30
29
  });
31
- throw new TypeError(errorMessage);
32
30
  };
33
31
 
34
32
  export { assertIsBigInt, assertIsNumber };
@@ -0,0 +1,209 @@
1
+ /*!
2
+ * ====================================================
3
+ * Rzl Utils-JS.
4
+ * ----------------------------------------------------
5
+ * Version: 3.9.1.
6
+ * Author: Rizalvin Dwiky.
7
+ * Repository: https://github.com/rzl-zone/utils-js.
8
+ * ====================================================
9
+ */
10
+ import { assertIsString } from './chunk-OSSFLQDD.js';
11
+ import { getPreciseType } from './chunk-J4TT33ZX.js';
12
+
13
+ var maxInt = 2147483647;
14
+ var base = 36;
15
+ var tMin = 1;
16
+ var tMax = 26;
17
+ var skew = 38;
18
+ var damp = 700;
19
+ var initialBias = 72;
20
+ var initialN = 128;
21
+ var delimiter = "-";
22
+ var regexPunycode = /^xn--/;
23
+ var regexNonASCII = /[^\0-\x7F]/;
24
+ var regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g;
25
+ var errors = {
26
+ overflow: "Overflow: input needs wider integers to process",
27
+ "not-basic": "Illegal input >= 0x80 (not a basic code point)",
28
+ "invalid-input": "Invalid input"
29
+ };
30
+ var floor = Math.floor;
31
+ var stringFromCharCode = String.fromCharCode;
32
+ function error(type) {
33
+ throw new RangeError(errors[type]);
34
+ }
35
+ function map(array, fn) {
36
+ const result = [];
37
+ let length = array.length;
38
+ while (length--) result[length] = fn(array[length]);
39
+ return result;
40
+ }
41
+ function mapDomain(domain, fn) {
42
+ const parts = domain.split("@");
43
+ let result = "";
44
+ if (parts.length > 1) {
45
+ result = parts[0] + "@";
46
+ domain = parts[1];
47
+ }
48
+ domain = domain.replace(regexSeparators, ".");
49
+ const labels = domain.split(".");
50
+ return result + map(labels, fn).join(".");
51
+ }
52
+ function ucs2decode(input) {
53
+ assertIsString(input, {
54
+ message: ({ currentType, validType }) => `Utils \`punycodeUtilsJS.ucs2.decode\`, parameter \`input\` must be of type \`${validType}\`, but received: \`${currentType}\`.`
55
+ });
56
+ const output = [];
57
+ let counter = 0;
58
+ const length = input.length;
59
+ while (counter < length) {
60
+ const value = input.charCodeAt(counter++);
61
+ if (value >= 55296 && value <= 56319 && counter < length) {
62
+ const extra = input.charCodeAt(counter++);
63
+ if ((extra & 64512) === 56320)
64
+ output.push(((value & 1023) << 10) + (extra & 1023) + 65536);
65
+ else {
66
+ output.push(value);
67
+ counter--;
68
+ }
69
+ } else output.push(value);
70
+ }
71
+ return output;
72
+ }
73
+ var ucs2encode = (points) => {
74
+ if (!Array.isArray(points) || !points.every((p) => typeof p === "number" && Number.isFinite(p))) {
75
+ throw new TypeError(
76
+ `Utils \`punycodeUtilsJS.ucs2.encode\`, parameter \`points\` must be an array of numbers, but received: \`${getPreciseType(
77
+ points
78
+ )}\`.`
79
+ );
80
+ }
81
+ return String.fromCodePoint(...points);
82
+ };
83
+ function basicToDigit(codePoint) {
84
+ if (codePoint >= 48 && codePoint < 58) return 26 + (codePoint - 48);
85
+ if (codePoint >= 65 && codePoint < 91) return codePoint - 65;
86
+ if (codePoint >= 97 && codePoint < 123) return codePoint - 97;
87
+ return base;
88
+ }
89
+ function digitToBasic(digit, flag) {
90
+ return digit + 22 + 75 * (digit < 26 ? 1 : 0) - Number(flag !== 0) * 32;
91
+ }
92
+ function adapt(delta, numPoints, firstTime) {
93
+ let k = 0;
94
+ delta = firstTime ? floor(delta / damp) : delta >> 1;
95
+ delta += floor(delta / numPoints);
96
+ while (delta > (base - tMin) * tMax >> 1) {
97
+ delta = floor(delta / (base - tMin));
98
+ k += base;
99
+ }
100
+ return floor(k + (base - tMin + 1) * delta / (delta + skew));
101
+ }
102
+ function decode(input) {
103
+ assertIsString(input, {
104
+ message: ({ currentType, validType }) => `Utils \`punycodeUtilsJS.decode\`, parameter \`input\` must be of type \`${validType}\`, but received: \`${currentType}\`.`
105
+ });
106
+ const output = [];
107
+ const inputLength = input.length;
108
+ let i = 0, n = initialN, bias = initialBias;
109
+ let basic = input.lastIndexOf(delimiter);
110
+ if (basic < 0) basic = 0;
111
+ for (let j = 0; j < basic; j++) {
112
+ if (input.charCodeAt(j) >= 128) error("not-basic");
113
+ output.push(input.charCodeAt(j));
114
+ }
115
+ for (let index = basic > 0 ? basic + 1 : 0; index < inputLength; ) {
116
+ const oldi = i;
117
+ let w = 1;
118
+ for (let k = base; ; k += base) {
119
+ if (index >= inputLength) error("invalid-input");
120
+ const digit = basicToDigit(input.charCodeAt(index++));
121
+ if (digit >= base) error("invalid-input");
122
+ if (digit > floor((maxInt - i) / w)) error("overflow");
123
+ i += digit * w;
124
+ const t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
125
+ if (digit < t) break;
126
+ const baseMinusT = base - t;
127
+ if (w > floor(maxInt / baseMinusT)) error("overflow");
128
+ w *= baseMinusT;
129
+ }
130
+ const out = output.length + 1;
131
+ bias = adapt(i - oldi, out, oldi === 0);
132
+ if (floor(i / out) > maxInt - n) error("overflow");
133
+ n += floor(i / out);
134
+ i %= out;
135
+ output.splice(i++, 0, n);
136
+ }
137
+ return String.fromCodePoint(...output);
138
+ }
139
+ function encode(input) {
140
+ assertIsString(input, {
141
+ message: ({ currentType, validType }) => `Utils \`punycodeUtilsJS.encode\`, parameter \`input\` must be of type \`${validType}\`, but received: \`${currentType}\`.`
142
+ });
143
+ const output = [];
144
+ const points = ucs2decode(input);
145
+ const inputLength = points.length;
146
+ let n = initialN, delta = 0, bias = initialBias;
147
+ for (const cp of points) if (cp < 128) output.push(stringFromCharCode(cp));
148
+ const basicLength = output.length;
149
+ let handledCPCount = basicLength;
150
+ if (basicLength) output.push(delimiter);
151
+ while (handledCPCount < inputLength) {
152
+ let m = maxInt;
153
+ for (const cp of points) if (cp >= n && cp < m) m = cp;
154
+ const handledCPCountPlusOne = handledCPCount + 1;
155
+ if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) error("overflow");
156
+ delta += (m - n) * handledCPCountPlusOne;
157
+ n = m;
158
+ for (const cp of points) {
159
+ if (cp < n) delta++;
160
+ if (cp === n) {
161
+ let q = delta;
162
+ for (let k = base; ; k += base) {
163
+ const t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
164
+ if (q < t) break;
165
+ output.push(stringFromCharCode(digitToBasic(t + (q - t) % (base - t), 0)));
166
+ q = floor((q - t) / (base - t));
167
+ }
168
+ output.push(stringFromCharCode(digitToBasic(q, 0)));
169
+ bias = adapt(delta, handledCPCountPlusOne, handledCPCount === basicLength);
170
+ delta = 0;
171
+ handledCPCount++;
172
+ }
173
+ }
174
+ delta++;
175
+ n++;
176
+ }
177
+ return output.join("");
178
+ }
179
+ function toUnicode(input) {
180
+ assertIsString(input, {
181
+ message: ({ currentType, validType }) => `Utils \`punycodeUtilsJS.toUnicode\`, parameter \`input\` must be of type \`${validType}\`, but received: \`${currentType}\`.`
182
+ });
183
+ return mapDomain(
184
+ input,
185
+ (str) => regexPunycode.test(str) ? decode(str.slice(4).toLowerCase()) : str
186
+ );
187
+ }
188
+ function toASCII(input) {
189
+ assertIsString(input, {
190
+ message: ({ currentType, validType }) => `Utils \`punycodeUtilsJS.toASCII\`, parameter \`input\` must be of type \`${validType}\`, but received: \`${currentType}\`.`
191
+ });
192
+ return mapDomain(
193
+ input,
194
+ (str) => regexNonASCII.test(str) ? "xn--" + encode(str) : str
195
+ );
196
+ }
197
+ var punycodeUtilsJS = {
198
+ version: "1.0.0",
199
+ ucs2: {
200
+ decode: ucs2decode,
201
+ encode: ucs2encode
202
+ },
203
+ decode,
204
+ encode,
205
+ toASCII,
206
+ toUnicode
207
+ };
208
+
209
+ export { punycodeUtilsJS };