@rzl-zone/utils-js 3.4.0 → 3.5.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 (117) hide show
  1. package/README.md +94 -45
  2. package/dist/assertions/index.cjs +34 -1
  3. package/dist/assertions/index.d.ts +2 -2
  4. package/dist/assertions/index.js +5 -1
  5. package/dist/chunk-2CQX5CBG.js +247 -1
  6. package/dist/chunk-2IOOEY45.cjs +20 -1
  7. package/dist/chunk-2WA36TC5.cjs +176 -0
  8. package/dist/chunk-3IBQ5MOM.js +6 -1
  9. package/dist/chunk-3VA554KW.js +23 -1
  10. package/dist/chunk-5757UBXJ.cjs +144 -1
  11. package/dist/chunk-5IGC6PBH.js +22 -1
  12. package/dist/chunk-5KJFVIQT.cjs +55 -1
  13. package/dist/chunk-6JFCSH7J.js +24 -1
  14. package/dist/chunk-6JFZL7YE.cjs +14 -1
  15. package/dist/chunk-7ODAAXX5.cjs +361 -1
  16. package/dist/chunk-BAV5T2E3.cjs +5 -1
  17. package/dist/chunk-CAH33WOQ.cjs +25 -1
  18. package/dist/chunk-CDCERIZ2.js +164 -0
  19. package/dist/chunk-CKTLUNWX.js +12 -1
  20. package/dist/chunk-CMW2TBOQ.js +522 -1
  21. package/dist/chunk-D3ENH7H6.cjs +87 -1
  22. package/dist/chunk-DEZZUYE2.js +139 -1
  23. package/dist/chunk-DVMHRLKP.cjs +6 -1
  24. package/dist/chunk-DWF2R5GD.cjs +212 -1
  25. package/dist/chunk-E55EQK2U.cjs +8 -1
  26. package/dist/chunk-E74U6CYP.cjs +8 -1
  27. package/dist/chunk-EL6A35UR.cjs +51 -1
  28. package/dist/chunk-F6IPNNSJ.cjs +531 -1
  29. package/dist/chunk-FJZGG54N.cjs +252 -1
  30. package/dist/chunk-FWCKOJZM.js +519 -1
  31. package/dist/chunk-FWHNWL2P.cjs +409 -1
  32. package/dist/chunk-GGEADHZO.js +78 -1
  33. package/dist/chunk-GQR4R5WY.js +21 -1
  34. package/dist/chunk-H66AC7GK.cjs +81 -1
  35. package/dist/chunk-HQWOFR56.cjs +23 -1
  36. package/dist/chunk-HYRQMTRH.cjs +14 -1
  37. package/dist/chunk-IRFL4MAX.js +53 -1
  38. package/dist/chunk-IVL7CKVH.cjs +26 -1
  39. package/dist/chunk-IZPBKKPO.js +6 -1
  40. package/dist/chunk-JBQMXC5I.cjs +93 -1
  41. package/dist/chunk-JEQEF5WD.js +81 -1
  42. package/dist/chunk-JMJQCN74.js +334 -1
  43. package/dist/chunk-KHO2SBNA.cjs +6 -1
  44. package/dist/chunk-KVAL5PAG.cjs +16 -1
  45. package/dist/chunk-L5RDAVVH.js +5 -1
  46. package/dist/chunk-LS6U7FAY.cjs +98 -1
  47. package/dist/chunk-NBZWMBO6.js +88 -1
  48. package/dist/chunk-NRF6LWBC.cjs +45 -1
  49. package/dist/chunk-OI5XKNZO.js +42 -1
  50. package/dist/chunk-ONZFBJVW.js +5 -1
  51. package/dist/chunk-OYTYSY7G.js +94 -1
  52. package/dist/chunk-PET42Z7W.js +107 -1
  53. package/dist/chunk-PZQ6I4JJ.cjs +559 -1
  54. package/dist/chunk-QBKAEVYG.js +102 -1
  55. package/dist/chunk-QNKGP5DY.js +5 -1
  56. package/dist/chunk-RIPKY4RU.js +407 -1
  57. package/dist/chunk-RZW35UN5.cjs +105 -1
  58. package/dist/chunk-SBFNXGTJ.js +207 -1
  59. package/dist/chunk-SBKGWRS5.js +12 -1
  60. package/dist/chunk-SIM77PU4.js +46 -1
  61. package/dist/chunk-T2T7K3KR.js +18 -1
  62. package/dist/chunk-T7PU2V7X.cjs +111 -1
  63. package/dist/chunk-UDA26MCU.cjs +6 -1
  64. package/dist/chunk-V45XJKHW.cjs +8 -1
  65. package/dist/chunk-VJDDGRIK.cjs +6 -1
  66. package/dist/chunk-W2WNBUDE.js +6 -1
  67. package/dist/chunk-WVSPXFTY.js +5 -1
  68. package/dist/chunk-XABCB3Y7.cjs +563 -1
  69. package/dist/chunk-XEDXFSGI.js +14 -1
  70. package/dist/chunk-YKPSRP5G.js +552 -1
  71. package/dist/chunk-YWHHVDT4.js +4 -1
  72. package/dist/chunk-ZETAZZLD.cjs +27 -1
  73. package/dist/conversions/index.cjs +97 -1
  74. package/dist/conversions/index.d.ts +1 -1
  75. package/dist/conversions/index.js +16 -1
  76. package/dist/events/index.cjs +25 -1
  77. package/dist/events/index.d.ts +1 -1
  78. package/dist/events/index.js +4 -1
  79. package/dist/formatters/index.cjs +55 -1
  80. package/dist/formatters/index.d.ts +1 -1
  81. package/dist/formatters/index.js +10 -1
  82. package/dist/generators/index.cjs +31 -1
  83. package/dist/generators/index.d.ts +1 -1
  84. package/dist/generators/index.js +6 -1
  85. package/dist/index.d.ts +1 -0
  86. package/dist/{isPlainObject-CEPWPiXh.d.ts → isPlainObject-FWmcJF6k.d.ts} +4 -4
  87. package/dist/next/index.cjs +205 -1
  88. package/dist/next/index.d.ts +1 -1
  89. package/dist/next/index.js +200 -1
  90. package/dist/next/server/index.cjs +34 -1
  91. package/dist/next/server/index.d.ts +1 -1
  92. package/dist/next/server/index.js +32 -1
  93. package/dist/operations/index.cjs +26 -1
  94. package/dist/operations/index.d.ts +1 -1
  95. package/dist/operations/index.js +9 -1
  96. package/dist/parsers/index.cjs +11 -1
  97. package/dist/parsers/index.d.ts +1 -1
  98. package/dist/parsers/index.js +2 -1
  99. package/dist/predicates/index.cjs +292 -1
  100. package/dist/predicates/index.d.ts +4 -4
  101. package/dist/predicates/index.js +15 -1
  102. package/dist/promises/index.cjs +18 -1
  103. package/dist/promises/index.d.ts +1 -1
  104. package/dist/promises/index.js +5 -1
  105. package/dist/rzl-utils.global.js +16 -1
  106. package/dist/strings/index.cjs +75 -1
  107. package/dist/strings/index.d.ts +1 -1
  108. package/dist/strings/index.js +6 -1
  109. package/dist/tailwind/index.cjs +36 -1
  110. package/dist/tailwind/index.d.ts +1 -1
  111. package/dist/tailwind/index.js +3 -1
  112. package/dist/urls/index.cjs +44 -1
  113. package/dist/urls/index.d.ts +1 -1
  114. package/dist/urls/index.js +15 -1
  115. package/package.json +16 -19
  116. package/dist/chunk-JYQTCICM.js +0 -1
  117. package/dist/chunk-YLA3DURS.cjs +0 -1
@@ -0,0 +1,176 @@
1
+ 'use strict';
2
+
3
+ var chunk6JFZL7YE_cjs = require('./chunk-6JFZL7YE.cjs');
4
+ var chunkPZQ6I4JJ_cjs = require('./chunk-PZQ6I4JJ.cjs');
5
+ var clsx = require('clsx');
6
+ var tailwindMergeV3 = require('tailwind-merge-v3');
7
+ var tailwindMergeV4 = require('tailwind-merge-v4');
8
+
9
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
10
+
11
+ var clsx__default = /*#__PURE__*/_interopDefault(clsx);
12
+ var validatorPropsTwMerge = (options) => {
13
+ if (!chunkPZQ6I4JJ_cjs.isPlainObject(options)) options = {};
14
+ let { config, prefix, extend, override, cacheSize, experimentalParseClassName } = options;
15
+ if (!chunkPZQ6I4JJ_cjs.isPlainObject(config)) config = {};
16
+ if (!chunkPZQ6I4JJ_cjs.isPlainObject(extend)) extend = {};
17
+ if (!chunkPZQ6I4JJ_cjs.isPlainObject(override)) override = {};
18
+ if (!chunkPZQ6I4JJ_cjs.isNumber(cacheSize)) cacheSize = void 0;
19
+ if (!chunkPZQ6I4JJ_cjs.isNonEmptyString(prefix)) prefix = void 0;
20
+ if (!chunkPZQ6I4JJ_cjs.isFunction(experimentalParseClassName)) experimentalParseClassName = void 0;
21
+ const theme = chunkPZQ6I4JJ_cjs.hasOwnProp(extend, "theme") ? extend.theme : {};
22
+ const classGroups = chunkPZQ6I4JJ_cjs.hasOwnProp(extend, "classGroups") ? extend.classGroups : {};
23
+ const conflictingClassGroupModifiers = chunkPZQ6I4JJ_cjs.hasOwnProp(
24
+ extend,
25
+ "conflictingClassGroupModifiers"
26
+ ) ? extend.conflictingClassGroupModifiers : {};
27
+ const conflictingClassGroups = chunkPZQ6I4JJ_cjs.hasOwnProp(extend, "conflictingClassGroups") ? extend.conflictingClassGroups : {};
28
+ const orderSensitiveModifiers = chunkPZQ6I4JJ_cjs.hasOwnProp(extend, "orderSensitiveModifiers") && chunkPZQ6I4JJ_cjs.isNonEmptyArray(extend.orderSensitiveModifiers) ? extend.orderSensitiveModifiers : [];
29
+ return {
30
+ config,
31
+ override,
32
+ cacheSize,
33
+ prefix,
34
+ experimentalParseClassName,
35
+ theme,
36
+ classGroups,
37
+ conflictingClassGroupModifiers,
38
+ conflictingClassGroups,
39
+ orderSensitiveModifiers
40
+ };
41
+ };
42
+ var defaultConfig = tailwindMergeV3.getDefaultConfig();
43
+ var twMergeDefaultV3 = (options = {}) => {
44
+ if (!chunkPZQ6I4JJ_cjs.isPlainObject(options)) options = {};
45
+ const {
46
+ cacheSize,
47
+ classGroups,
48
+ config,
49
+ conflictingClassGroupModifiers,
50
+ conflictingClassGroups,
51
+ override,
52
+ prefix,
53
+ theme,
54
+ experimentalParseClassName
55
+ } = validatorPropsTwMerge(options);
56
+ return tailwindMergeV3.extendTailwindMerge({
57
+ prefix: prefix ?? config.prefix,
58
+ cacheSize: cacheSize || defaultConfig.cacheSize,
59
+ experimentalParseClassName,
60
+ override,
61
+ extend: {
62
+ conflictingClassGroupModifiers: {
63
+ ...defaultConfig.conflictingClassGroupModifiers,
64
+ ...conflictingClassGroupModifiers
65
+ },
66
+ theme: { ...defaultConfig.theme, ...theme },
67
+ conflictingClassGroups: {
68
+ ...defaultConfig.conflictingClassGroups,
69
+ ...conflictingClassGroups
70
+ },
71
+ classGroups: {
72
+ ...defaultConfig.classGroups,
73
+ ...classGroups,
74
+ "text-shadow": ["", "-sm", "-md", "-lg", "-xl", "-xxl", "-none", "-default"].map(
75
+ (size) => `text-shadow${size}`
76
+ ),
77
+ "font-size": Object.keys({
78
+ ...config.theme?.fontSize || {},
79
+ ...config.theme?.extend?.fontSize || {}
80
+ }).map((size) => `text-${size}`)
81
+ }
82
+ }
83
+ });
84
+ };
85
+ var defaultConfig2 = tailwindMergeV4.getDefaultConfig();
86
+ var twMergeDefaultV4 = (options = {}) => {
87
+ if (!chunkPZQ6I4JJ_cjs.isPlainObject(options)) options = {};
88
+ const {
89
+ cacheSize,
90
+ classGroups,
91
+ config,
92
+ conflictingClassGroupModifiers,
93
+ conflictingClassGroups,
94
+ orderSensitiveModifiers,
95
+ override,
96
+ prefix,
97
+ theme,
98
+ experimentalParseClassName
99
+ } = validatorPropsTwMerge(options);
100
+ return tailwindMergeV4.extendTailwindMerge({
101
+ prefix: prefix || config.prefix,
102
+ cacheSize: cacheSize || defaultConfig2.cacheSize,
103
+ experimentalParseClassName,
104
+ override,
105
+ extend: {
106
+ conflictingClassGroupModifiers: {
107
+ ...defaultConfig2.conflictingClassGroupModifiers,
108
+ ...conflictingClassGroupModifiers
109
+ },
110
+ theme: { ...defaultConfig2.theme, ...theme },
111
+ conflictingClassGroups: {
112
+ ...defaultConfig2.conflictingClassGroups,
113
+ ...conflictingClassGroups
114
+ },
115
+ orderSensitiveModifiers: [
116
+ ...defaultConfig2.orderSensitiveModifiers,
117
+ ...orderSensitiveModifiers
118
+ ],
119
+ classGroups: {
120
+ ...defaultConfig2.classGroups,
121
+ ...classGroups,
122
+ "text-shadow": ["", "-sm", "-md", "-lg", "-xl", "-xxl", "-none", "-default"].map(
123
+ (size) => `text-shadow${size}`
124
+ ),
125
+ "font-size": Object.keys({
126
+ ...config.theme?.fontSize || {},
127
+ ...config.theme?.extend?.fontSize || {}
128
+ }).map((size) => `text-${size}`)
129
+ }
130
+ }
131
+ });
132
+ };
133
+ var defaultTwMergeV3 = twMergeDefaultV3();
134
+ var defaultTwMergeV4 = twMergeDefaultV4();
135
+ var cnV3 = (...classes) => {
136
+ return defaultTwMergeV3(clsx__default.default(...classes));
137
+ };
138
+ var cnV4 = (...classes) => {
139
+ return defaultTwMergeV4(clsx__default.default(...classes));
140
+ };
141
+ var customCnV3 = (customTwMergeV3, ...classes) => {
142
+ if (!chunkPZQ6I4JJ_cjs.isFunction(customTwMergeV3)) {
143
+ throw new TypeError(
144
+ `first Parameter (\`customTwMergeV3\`) must be of type \`function\`, but received: \`${chunkPZQ6I4JJ_cjs.getPreciseType(
145
+ customTwMergeV3
146
+ )}\`.`
147
+ );
148
+ }
149
+ return customTwMergeV3(clsx__default.default(...classes));
150
+ };
151
+ var customCnV4 = (customTwMergeV4, ...classes) => {
152
+ if (!chunkPZQ6I4JJ_cjs.isFunction(customTwMergeV4)) {
153
+ throw new TypeError(
154
+ `first Parameter (\`customTwMergeV4\`) must be of type \`function\`, but received: \`${chunkPZQ6I4JJ_cjs.getPreciseType(
155
+ customTwMergeV4
156
+ )}\`.`
157
+ );
158
+ }
159
+ return customTwMergeV4(clsx__default.default(...classes));
160
+ };
161
+ var shouldForwardProp = (props) => {
162
+ chunk6JFZL7YE_cjs.assertIsArray(props, {
163
+ message: ({ currentType, validType }) => `First parameter (\`props\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`
164
+ });
165
+ return (propName) => {
166
+ return !props.map((p) => p.toString()).includes(propName.toString());
167
+ };
168
+ };
169
+
170
+ exports.cnV3 = cnV3;
171
+ exports.cnV4 = cnV4;
172
+ exports.customCnV3 = customCnV3;
173
+ exports.customCnV4 = customCnV4;
174
+ exports.shouldForwardProp = shouldForwardProp;
175
+ exports.twMergeDefaultV3 = twMergeDefaultV3;
176
+ exports.twMergeDefaultV4 = twMergeDefaultV4;
@@ -1 +1,6 @@
1
- import{isNumber as r}from"./chunk-CMW2TBOQ.js";function i(i){return r(i)&&Number.isFinite(i)}export{i as isFinite};
1
+ import { isNumber } from './chunk-CMW2TBOQ.js';
2
+ function isFinite(value) {
3
+ return isNumber(value) && Number.isFinite(value);
4
+ }
5
+
6
+ export { isFinite };
@@ -1 +1,23 @@
1
- import{isBigInt as r}from"./chunk-QNKGP5DY.js";import{resolveErrorMessageAssertions as e,hasOwnProp as o,isNumber as i}from"./chunk-CMW2TBOQ.js";var n=(o,i={})=>{if(r(o))return;const n=e({value:o,options:i,requiredValidType:"big int"});throw new TypeError(n)},t=(r,n={})=>{const t=o(n,"includeNaN")?n.includeNaN:void 0;if(i(r,{includeNaN:t}))return;const u=e({value:r,options:n,requiredValidType:"number"});throw new TypeError(u)};export{n as assertIsBigInt,t as assertIsNumber};
1
+ import { isBigInt } from './chunk-QNKGP5DY.js';
2
+ import { resolveErrorMessageAssertions, hasOwnProp, isNumber } from './chunk-CMW2TBOQ.js';
3
+ var assertIsBigInt = (value, options = {}) => {
4
+ if (isBigInt(value)) return;
5
+ const errorMessage = resolveErrorMessageAssertions({
6
+ value,
7
+ options,
8
+ requiredValidType: "big int"
9
+ });
10
+ throw new TypeError(errorMessage);
11
+ };
12
+ var assertIsNumber = (value, options = {}) => {
13
+ const includeNaN = hasOwnProp(options, "includeNaN") ? options.includeNaN : void 0;
14
+ if (isNumber(value, { includeNaN })) return;
15
+ const errorMessage = resolveErrorMessageAssertions({
16
+ value,
17
+ options,
18
+ requiredValidType: "number"
19
+ });
20
+ throw new TypeError(errorMessage);
21
+ };
22
+
23
+ export { assertIsBigInt, assertIsNumber };
@@ -1 +1,144 @@
1
- "use strict";var e=require("./chunk-DVMHRLKP.cjs"),t=require("./chunk-T7PU2V7X.cjs"),r=require("./chunk-PZQ6I4JJ.cjs");var n=(n,s)=>{if(!e.isInteger(n)||!e.isInteger(s))throw new TypeError(`First parameter (\`min\`) and second parameter (\`max\`) must be of type \`integer-number\`${i(n,s)}value, but received: ['min': \`${r.getPreciseType(n)}\` - (with value: \`${t.safeStableStringify(n)})\`, 'max': \`${r.getPreciseType(s)}\` - (with value: \`${t.safeStableStringify(s)}\`)].`);if(n>s)throw new RangeError(`First parameter (\`min\`) must be less than or equal to second parameter (\`max\`), but received: ['min': ${a(n)}, 'max': ${a(s)}].`);return n=Math.max(1,n),s=Math.min(Number.MAX_SAFE_INTEGER,s),Math.floor(Math.random()*(s-n+1))+n},a=e=>r.isNumber(e,{includeNaN:!0})?e===Number.MIN_VALUE?"`Number.MIN_VALUE`":`${e}`:`\`${r.getPreciseType(e)}\``,i=(...e)=>e.some(e=>r.isNumber(e,{includeNaN:!0})&&e===Number.MIN_VALUE)?" and can't be `Number.MIN_VALUE` ":" ";exports.getRandomItem=function(e){if(!r.isNonEmptyArray(e))return;return e[Math.floor(Math.random()*(e.length||0))]},exports.randomInt=n,exports.randomIntByLength=a=>{r.isPlainObject(a)||(a={});const{minLength:i=1,maxLength:s=16,avoidZero:m=!1}=a;if(r.assertIsBoolean(m,{message:({currentType:e,validType:t})=>`Parameters \`avoidZero\` must be of type \`${t}\`, but received: \`${e}\`.`}),!e.isInteger(i)||!e.isInteger(s))throw new TypeError(`Parameters \`minLength\` and \`maxLength\` must be of type \`integer-number\`, but received: ['minLength': \`${r.getPreciseType(i)}\` - (with value: ${t.safeStableStringify(i)}), 'maxLength': \`${r.getPreciseType(s)}\` - (with value: ${t.safeStableStringify(s)})].`);if(i<1||s>16||i>s)throw new RangeError(`Invalid range at parameters \`minLength\` must be ≥ 1, \`maxLength\` must be ≤ 16, and \`minLength\` ≤ \`maxLength\`, but received: ['minLength': \`${i}\`, 'maxLength': \`${s}\`].`);const o=i===s?i:n(i,s),h=10**(o-1);let u=n(h,10**o-1);return m&&0===u&&(u=h),u},exports.randomStr=a=>{r.isPlainObject(a)||(a={});const{minLength:i=40,maxLength:s=40,type:m="string",avoidWhiteSpace:o=!0}=a;if(r.assertIsBoolean(o,{message:({currentType:e,validType:t})=>`Parameters \`avoidWhiteSpace\` property of the \`options\` (first-parameter) must be of type \`${t}\`, but received: \`${e}\`.`}),!e.isInteger(i)||!e.isInteger(s))throw new TypeError(`Parameters \`minLength\` and \`maxLength\` must be of type \`integer-number\`, but received: ['minLength': \`${r.getPreciseType(i)}\` - (with value: ${t.safeStableStringify(i)}), 'maxLength': \`${r.getPreciseType(s)}\` - (with value: ${t.safeStableStringify(s)})].`);if(i<1||s>5e3||i>s)throw new RangeError(`Invalid range at parameters \`minLength\` must be ≥ 1, \`maxLength\` must be ≤ 5000, and \`minLength\` ≤ \`maxLength\`, but received: ['minLength': \`${i}\`, 'maxLength': \`${s}\`].`);if("string"!==m&&"number"!==m)throw new TypeError(`Parameter \`type\` must be of type \`string\` with value one of "string" | "number", but received: \`${r.getPreciseType(m)}\`, with value: ${t.safeStableStringify(m)}.`);const h=n(i,s),u="number"===m?(r.isNaN(Number(a.replaceGenInt))?void 0:a.replaceGenInt)??"0123456789":(a.replaceGenStr?a.replaceGenStr:void 0)??"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",g=(c=u,(o?c.replace(/\s|\n|\t/g,""):c)+(a.addChar||""));var c;if(!g.length){throw new Error(`Character set is empty. ${(()=>"number"===m?o?"If `avoidWhiteSpace` is true, and `replaceGenInt` cant be empty-string value, ensure `replaceGenInt` has valid characters and non-nan string number.":"Ensure `replaceGenInt` has valid characters and not a NaN number string while convert to number.":"Ensure `replaceGenStr` has valid characters and non empty string.")()}`)}let p="";for(let e=0;e<h;e++)p+=g.charAt(Math.floor(Math.random()*g.length));return p};
1
+ 'use strict';
2
+
3
+ var chunkDVMHRLKP_cjs = require('./chunk-DVMHRLKP.cjs');
4
+ var chunkT7PU2V7X_cjs = require('./chunk-T7PU2V7X.cjs');
5
+ var chunkPZQ6I4JJ_cjs = require('./chunk-PZQ6I4JJ.cjs');
6
+ function getRandomItem(array) {
7
+ if (!chunkPZQ6I4JJ_cjs.isNonEmptyArray(array)) return void 0;
8
+ const randomIndex = Math.floor(Math.random() * (array.length || 0));
9
+ return array[randomIndex];
10
+ }
11
+ var randomInt = (min, max) => {
12
+ if (!chunkDVMHRLKP_cjs.isInteger(min) || !chunkDVMHRLKP_cjs.isInteger(max)) {
13
+ throw new TypeError(
14
+ `First parameter (\`min\`) and second parameter (\`max\`) must be of type \`integer-number\`${minValueNote(
15
+ min,
16
+ max
17
+ )}value, but received: ['min': \`${chunkPZQ6I4JJ_cjs.getPreciseType(
18
+ min
19
+ )}\` - (with value: \`${chunkT7PU2V7X_cjs.safeStableStringify(min)})\`, 'max': \`${chunkPZQ6I4JJ_cjs.getPreciseType(
20
+ max
21
+ )}\` - (with value: \`${chunkT7PU2V7X_cjs.safeStableStringify(max)}\`)].`
22
+ );
23
+ }
24
+ if (min > max) {
25
+ throw new RangeError(
26
+ `First parameter (\`min\`) must be less than or equal to second parameter (\`max\`), but received: ['min': ${formatValue(
27
+ min
28
+ )}, 'max': ${formatValue(max)}].`
29
+ );
30
+ }
31
+ min = Math.max(1, min);
32
+ max = Math.min(Number.MAX_SAFE_INTEGER, max);
33
+ return Math.floor(Math.random() * (max - min + 1)) + min;
34
+ };
35
+ var formatValue = (value) => {
36
+ return chunkPZQ6I4JJ_cjs.isNumber(value, { includeNaN: true }) ? value === Number.MIN_VALUE ? "`Number.MIN_VALUE`" : `${value}` : `\`${chunkPZQ6I4JJ_cjs.getPreciseType(value)}\``;
37
+ };
38
+ var minValueNote = (...values) => {
39
+ return values.some((v) => chunkPZQ6I4JJ_cjs.isNumber(v, { includeNaN: true }) && v === Number.MIN_VALUE) ? " and can't be `Number.MIN_VALUE` " : " ";
40
+ };
41
+ var randomIntByLength = (options) => {
42
+ if (!chunkPZQ6I4JJ_cjs.isPlainObject(options)) {
43
+ options = {};
44
+ }
45
+ const { minLength = 1, maxLength = 16, avoidZero = false } = options;
46
+ chunkPZQ6I4JJ_cjs.assertIsBoolean(avoidZero, {
47
+ message({ currentType, validType }) {
48
+ return `Parameters \`avoidZero\` must be of type \`${validType}\`, but received: \`${currentType}\`.`;
49
+ }
50
+ });
51
+ if (!chunkDVMHRLKP_cjs.isInteger(minLength) || !chunkDVMHRLKP_cjs.isInteger(maxLength)) {
52
+ throw new TypeError(
53
+ `Parameters \`minLength\` and \`maxLength\` must be of type \`integer-number\`, but received: ['minLength': \`${chunkPZQ6I4JJ_cjs.getPreciseType(
54
+ minLength
55
+ )}\` - (with value: ${chunkT7PU2V7X_cjs.safeStableStringify(
56
+ minLength
57
+ )}), 'maxLength': \`${chunkPZQ6I4JJ_cjs.getPreciseType(
58
+ maxLength
59
+ )}\` - (with value: ${chunkT7PU2V7X_cjs.safeStableStringify(maxLength)})].`
60
+ );
61
+ }
62
+ if (minLength < 1 || maxLength > 16 || minLength > maxLength) {
63
+ throw new RangeError(
64
+ `Invalid range at parameters \`minLength\` must be \u2265 1, \`maxLength\` must be \u2264 16, and \`minLength\` \u2264 \`maxLength\`, but received: ['minLength': \`${minLength}\`, 'maxLength': \`${maxLength}\`].`
65
+ );
66
+ }
67
+ const randomLength = minLength === maxLength ? minLength : randomInt(minLength, maxLength);
68
+ const minValue = 10 ** (randomLength - 1);
69
+ const maxValue = 10 ** randomLength - 1;
70
+ let result = randomInt(minValue, maxValue);
71
+ if (avoidZero && result === 0) {
72
+ result = minValue;
73
+ }
74
+ return result;
75
+ };
76
+ var randomStr = (options) => {
77
+ if (!chunkPZQ6I4JJ_cjs.isPlainObject(options)) {
78
+ options = {};
79
+ }
80
+ const {
81
+ minLength = 40,
82
+ maxLength = 40,
83
+ type = "string",
84
+ avoidWhiteSpace = true
85
+ } = options;
86
+ chunkPZQ6I4JJ_cjs.assertIsBoolean(avoidWhiteSpace, {
87
+ message({ currentType, validType }) {
88
+ return `Parameters \`avoidWhiteSpace\` property of the \`options\` (first-parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`;
89
+ }
90
+ });
91
+ if (!chunkDVMHRLKP_cjs.isInteger(minLength) || !chunkDVMHRLKP_cjs.isInteger(maxLength)) {
92
+ throw new TypeError(
93
+ `Parameters \`minLength\` and \`maxLength\` must be of type \`integer-number\`, but received: ['minLength': \`${chunkPZQ6I4JJ_cjs.getPreciseType(
94
+ minLength
95
+ )}\` - (with value: ${chunkT7PU2V7X_cjs.safeStableStringify(
96
+ minLength
97
+ )}), 'maxLength': \`${chunkPZQ6I4JJ_cjs.getPreciseType(
98
+ maxLength
99
+ )}\` - (with value: ${chunkT7PU2V7X_cjs.safeStableStringify(maxLength)})].`
100
+ );
101
+ }
102
+ if (minLength < 1 || maxLength > 5e3 || minLength > maxLength) {
103
+ throw new RangeError(
104
+ `Invalid range at parameters \`minLength\` must be \u2265 1, \`maxLength\` must be \u2264 5000, and \`minLength\` \u2264 \`maxLength\`, but received: ['minLength': \`${minLength}\`, 'maxLength': \`${maxLength}\`].`
105
+ );
106
+ }
107
+ if (type !== "string" && type !== "number") {
108
+ throw new TypeError(
109
+ `Parameter \`type\` must be of type \`string\` with value one of "string" | "number", but received: \`${chunkPZQ6I4JJ_cjs.getPreciseType(
110
+ type
111
+ )}\`, with value: ${chunkT7PU2V7X_cjs.safeStableStringify(type)}.`
112
+ );
113
+ }
114
+ const length = randomInt(minLength, maxLength);
115
+ const cleanCharacters = (charSet) => {
116
+ return avoidWhiteSpace ? charSet.replace(/\s|\n|\t/g, "") : charSet;
117
+ };
118
+ const defaultNumberSet = "0123456789";
119
+ const defaultStringSet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
120
+ const baseCharSet = type === "number" ? (!chunkPZQ6I4JJ_cjs.isNaN(Number(options.replaceGenInt)) ? options.replaceGenInt : void 0) ?? defaultNumberSet : (options.replaceGenStr ? options.replaceGenStr : void 0) ?? defaultStringSet;
121
+ const characterSet = cleanCharacters(baseCharSet) + (options.addChar || "");
122
+ if (!characterSet.length) {
123
+ const errCharSet = () => {
124
+ if (type === "number") {
125
+ if (avoidWhiteSpace) {
126
+ return `If \`avoidWhiteSpace\` is true, and \`replaceGenInt\` cant be empty-string value, ensure \`replaceGenInt\` has valid characters and non-nan string number.`;
127
+ }
128
+ return `Ensure \`replaceGenInt\` has valid characters and not a NaN number string while convert to number.`;
129
+ }
130
+ return `Ensure \`replaceGenStr\` has valid characters and non empty string.`;
131
+ };
132
+ throw new Error(`Character set is empty. ${errCharSet()}`);
133
+ }
134
+ let result = "";
135
+ for (let i = 0; i < length; i++) {
136
+ result += characterSet.charAt(Math.floor(Math.random() * characterSet.length));
137
+ }
138
+ return result;
139
+ };
140
+
141
+ exports.getRandomItem = getRandomItem;
142
+ exports.randomInt = randomInt;
143
+ exports.randomIntByLength = randomIntByLength;
144
+ exports.randomStr = randomStr;
@@ -1 +1,22 @@
1
- import{isEmptyValue as t}from"./chunk-GQR4R5WY.js";var r=(r,o={})=>!t(r,o),o=new Set(["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]","[object BigInt64Array]","[object BigUint64Array]"]);function e(t){return null!=t&&"object"==typeof t&&o.has(Object.prototype.toString.call(t))}export{r as isNonEmptyValue,e as isTypedArray};
1
+ import { isEmptyValue } from './chunk-GQR4R5WY.js';
2
+ var isNonEmptyValue = (value, options = {}) => {
3
+ return !isEmptyValue(value, options);
4
+ };
5
+ var typedArrayTags = /* @__PURE__ */ new Set([
6
+ "[object Int8Array]",
7
+ "[object Uint8Array]",
8
+ "[object Uint8ClampedArray]",
9
+ "[object Int16Array]",
10
+ "[object Uint16Array]",
11
+ "[object Int32Array]",
12
+ "[object Uint32Array]",
13
+ "[object Float32Array]",
14
+ "[object Float64Array]",
15
+ "[object BigInt64Array]",
16
+ "[object BigUint64Array]"
17
+ ]);
18
+ function isTypedArray(value) {
19
+ return value != null && typeof value === "object" && typedArrayTags.has(Object.prototype.toString.call(value));
20
+ }
21
+
22
+ export { isNonEmptyValue, isTypedArray };
@@ -1 +1,55 @@
1
- "use strict";var e=require("./chunk-PZQ6I4JJ.cjs");exports.parseCurrencyString=l=>{if(!e.isNonEmptyString(l))return 0;let c=l.trim().replace(/\u00A0/g,"").replace(/\u202F/g,""),r=!1;/^\(.*\)$/.test(c)&&(r=!0,c=c.slice(1,-1).trim()),c=c.replace(/^[-\s]+/,e=>e.includes("-")?"-":"").replace(/[\s.,-]+$/,""),r=r||/^-/.test(c)||/^[^\d]*-/.test(c);let s=c.replace(/[^0-9.,'\s]/g,"").replace(/[\s']/g,"");const t=s.match(/,\d{2}/g);if(t&&t.length>1)s=s.replace(/,/g,"");else{const e=(s.match(/\./g)||[]).length,l=(s.match(/,/g)||[]).length;if(e>1&&0===l)s=s.replace(/\./g,"");else if(l>1&&0===e)s=s.replace(/,/g,"");else{const e=s.lastIndexOf(","),l=s.lastIndexOf(".");if(e>l)s=s.replace(/\./g,"").replace(",",".");else if(l>e)s=s.replace(/,/g,"");else if(e>l){const l=s.slice(0,e).replace(/,/g,"").replace(/\./g,""),c=s.slice(e+1);s=l+"."+c}else if(l>e){const e=s.slice(0,l).replace(/\./g,"").replace(/,/g,""),c=s.slice(l+1);s=e+"."+c}else-1!==e?s=s.replace(/,/g,""):-1!==l&&(s=s.replace(/\./g,""))}}const a=parseFloat(s)||0;return r?-a:a};
1
+ 'use strict';
2
+
3
+ var chunkPZQ6I4JJ_cjs = require('./chunk-PZQ6I4JJ.cjs');
4
+ var parseCurrencyString = (input) => {
5
+ if (!chunkPZQ6I4JJ_cjs.isNonEmptyString(input)) return 0;
6
+ let trimmed = input.trim().replace(/\u00A0/g, "").replace(/\u202F/g, "");
7
+ let isNegative = false;
8
+ if (/^\(.*\)$/.test(trimmed)) {
9
+ isNegative = true;
10
+ trimmed = trimmed.slice(1, -1).trim();
11
+ }
12
+ trimmed = trimmed.replace(/^[-\s]+/, (match) => match.includes("-") ? "-" : "").replace(/[\s.,-]+$/, "");
13
+ isNegative = isNegative || /^-/.test(trimmed) || /^[^\d]*-/.test(trimmed);
14
+ const cleaned = trimmed.replace(/[^0-9.,'\s]/g, "");
15
+ let cleanedNoSpace = cleaned.replace(/[\s']/g, "");
16
+ const indianMatches = cleanedNoSpace.match(/,\d{2}/g);
17
+ const isIndianStyle = indianMatches && indianMatches.length > 1;
18
+ if (isIndianStyle) {
19
+ cleanedNoSpace = cleanedNoSpace.replace(/,/g, "");
20
+ } else {
21
+ const dotCount = (cleanedNoSpace.match(/\./g) || []).length;
22
+ const commaCount = (cleanedNoSpace.match(/,/g) || []).length;
23
+ if (dotCount > 1 && commaCount === 0) {
24
+ cleanedNoSpace = cleanedNoSpace.replace(/\./g, "");
25
+ } else if (commaCount > 1 && dotCount === 0) {
26
+ cleanedNoSpace = cleanedNoSpace.replace(/,/g, "");
27
+ } else {
28
+ const lastComma = cleanedNoSpace.lastIndexOf(",");
29
+ const lastDot = cleanedNoSpace.lastIndexOf(".");
30
+ if (lastComma > lastDot) {
31
+ cleanedNoSpace = cleanedNoSpace.replace(/\./g, "").replace(",", ".");
32
+ } else if (lastDot > lastComma) {
33
+ cleanedNoSpace = cleanedNoSpace.replace(/,/g, "");
34
+ } else {
35
+ if (lastComma > lastDot) {
36
+ const beforeDecimal = cleanedNoSpace.slice(0, lastComma).replace(/,/g, "").replace(/\./g, "");
37
+ const afterDecimal = cleanedNoSpace.slice(lastComma + 1);
38
+ cleanedNoSpace = beforeDecimal + "." + afterDecimal;
39
+ } else if (lastDot > lastComma) {
40
+ const beforeDecimal = cleanedNoSpace.slice(0, lastDot).replace(/\./g, "").replace(/,/g, "");
41
+ const afterDecimal = cleanedNoSpace.slice(lastDot + 1);
42
+ cleanedNoSpace = beforeDecimal + "." + afterDecimal;
43
+ } else if (lastComma !== -1) {
44
+ cleanedNoSpace = cleanedNoSpace.replace(/,/g, "");
45
+ } else if (lastDot !== -1) {
46
+ cleanedNoSpace = cleanedNoSpace.replace(/\./g, "");
47
+ }
48
+ }
49
+ }
50
+ }
51
+ const num = parseFloat(cleanedNoSpace) || 0;
52
+ return isNegative ? -num : num;
53
+ };
54
+
55
+ exports.parseCurrencyString = parseCurrencyString;
@@ -1 +1,24 @@
1
- import{isArray as e,isObject as t,assertIsPlainObject as r,hasOwnProp as o,assertIsBoolean as c}from"./chunk-CMW2TBOQ.js";var n=t=>!e(t)||0===t.length;function s(e,n={}){if(!t(e))return!0;r(n,{message:({currentType:e,validType:t})=>`Second parameter (\`options\`) must be of type \`${t}\`, but received: \`${e}\`.`});const s=!!o(n,"checkSymbols")&&n.checkSymbols;c(s,{message:({currentType:e,validType:t})=>`Parameter \`checkSymbols\` property of the \`options\` (second parameter) must be of type \`${t}\`, but received: \`${e}\`.`});const p=0===Object.keys(e).length;return s?p&&0===Object.getOwnPropertySymbols(e).length:p}export{n as isEmptyArray,s as isEmptyObject};
1
+ import { isArray, isObject, assertIsPlainObject, hasOwnProp, assertIsBoolean } from './chunk-CMW2TBOQ.js';
2
+ var isEmptyArray = (value) => {
3
+ if (!isArray(value)) return true;
4
+ return value.length === 0;
5
+ };
6
+ function isEmptyObject(value, options = {}) {
7
+ if (!isObject(value)) {
8
+ return true;
9
+ }
10
+ assertIsPlainObject(options, {
11
+ message: ({ currentType, validType }) => `Second parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`
12
+ });
13
+ const checkSymbols = hasOwnProp(options, "checkSymbols") ? options.checkSymbols : false;
14
+ assertIsBoolean(checkSymbols, {
15
+ message: ({ currentType, validType }) => `Parameter \`checkSymbols\` property of the \`options\` (second parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`
16
+ });
17
+ const hasNoKeys = Object.keys(value).length === 0;
18
+ if (checkSymbols) {
19
+ return hasNoKeys && Object.getOwnPropertySymbols(value).length === 0;
20
+ }
21
+ return hasNoKeys;
22
+ }
23
+
24
+ export { isEmptyArray, isEmptyObject };
@@ -1 +1,14 @@
1
- "use strict";var r=require("./chunk-PZQ6I4JJ.cjs");exports.assertIsArray=function(e,s){if(r.isArray(e))return;const o=r.resolveErrorMessageAssertions({value:e,options:s,requiredValidType:"array"});throw new TypeError(o)};
1
+ 'use strict';
2
+
3
+ var chunkPZQ6I4JJ_cjs = require('./chunk-PZQ6I4JJ.cjs');
4
+ function assertIsArray(value, options) {
5
+ if (chunkPZQ6I4JJ_cjs.isArray(value)) return;
6
+ const errorMessage = chunkPZQ6I4JJ_cjs.resolveErrorMessageAssertions({
7
+ value,
8
+ options,
9
+ requiredValidType: "array"
10
+ });
11
+ throw new TypeError(errorMessage);
12
+ }
13
+
14
+ exports.assertIsArray = assertIsArray;