@rzl-zone/utils-js 3.3.1 → 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 (132) 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 +2 -2
  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 +2 -2
  81. package/dist/formatters/index.js +10 -1
  82. package/dist/generators/index.cjs +31 -1
  83. package/dist/generators/index.d.ts +2 -2
  84. package/dist/generators/index.js +6 -1
  85. package/dist/index.d.ts +1 -1
  86. package/dist/{isPlainObject-DGJkcFYw.d.ts → isPlainObject-FWmcJF6k.d.ts} +5 -5
  87. package/dist/next/index.cjs +205 -1
  88. package/dist/next/index.d.ts +2 -2
  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 +2 -2
  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 +2 -2
  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 +2 -2
  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 -24
  116. package/dist/NumberRangeUnion-B6bhM2s7.d.ts +0 -33
  117. package/dist/any-v4TsK9ES.d.ts +0 -66
  118. package/dist/arrays-normalize-recursive-BqmVuFlD.d.ts +0 -72
  119. package/dist/chunk-JYQTCICM.js +0 -1
  120. package/dist/chunk-YLA3DURS.cjs +0 -1
  121. package/dist/extends-DtdRjDyU.d.ts +0 -343
  122. package/dist/if-ChM35c_q.d.ts +0 -19
  123. package/dist/is-array-BJeHxPM3.d.ts +0 -952
  124. package/dist/never-D89PbPh5.d.ts +0 -66
  125. package/dist/nils-CO8zLHSB.d.ts +0 -151
  126. package/dist/or-C6qzKt2I.d.ts +0 -82
  127. package/dist/override-CL2olHE5.d.ts +0 -59
  128. package/dist/pick-BSMX6Xe2.d.ts +0 -15
  129. package/dist/prettify-3o8_Kw6b.d.ts +0 -564
  130. package/dist/promises-LU7K00H0.d.ts +0 -72
  131. package/dist/string-B1jlOnws.d.ts +0 -312
  132. package/dist/types/index.d.ts +0 -3345
@@ -1 +1,98 @@
1
- "use strict";var e=require("./chunk-FJZGG54N.cjs"),r=require("./chunk-JBQMXC5I.cjs"),t=require("./chunk-ZETAZZLD.cjs"),s=require("./chunk-6JFZL7YE.cjs"),i=require("./chunk-T7PU2V7X.cjs"),n=require("./chunk-PZQ6I4JJ.cjs"),a=e=>{s.assertIsArray(e,{message:({currentType:e,validType:r})=>`First parameter (\`values\`) must be of type \`${r}\` (array literal or instance), but received: \`${e}\`.`});const t=[];return e.forEach((s,i)=>{for(let n=i+1;n<e.length;n++)if(r.isEqual(s,e[n])){t.some(e=>r.isEqual(e,s))||t.push(s);break}}),t};exports.findDuplicates=a,exports.omitKeys=(e,r)=>{if(!n.isPlainObject(e))return{};s.assertIsArray(r,{message:({currentType:e,validType:r})=>`Second parameter (\`keysToOmit\`) must be of type \`${r}\` (array literal or instance), but received: \`${e}\`.`});const t=a(r);if(t.length>0)throw new Error(`Function "omitKeys" Error: Duplicate keys detected - \`${t}\``);return Object.fromEntries(Object.entries(e).filter(([e])=>!r.includes(e)))},exports.omitKeysDeep=(r,c)=>{if(!n.isPlainObject(r))return{};s.assertIsArray(c,{message:({currentType:e,validType:r})=>`Second parameter (\`keysToOmit\`) must be of type \`${r}\` (array literal or instance), but received: \`${e}\`.`});const o=a(c);if(n.isNonEmptyArray(o))throw new Error(`Function "omitKeysDeep" Error: Duplicate keys detected - \`${i.safeStableStringify(o)}\`.`);const u=(e,r)=>{if(!n.isObjectOrArray(e))return e;const[s,...i]=r;if(t.isEmptyArray(i))if(n.isArray(e)){const r=parseInt(s);!n.isNaN(r)&&r in e&&e.splice(r,1)}else delete e[s];else{const r=e[s];n.isObjectOrArray(r)&&(e[s]=u(r,i))}return e},y=e=>{if(n.isArray(e))return e.map(y).filter(e=>!(n.isObjectOrArray(e)&&0===Object.keys(e).length));if(n.isObjectOrArray(e)){return Object.fromEntries(Object.entries(e).map(([e,r])=>[e,y(r)]).filter(([,e])=>!(n.isUndefined(e)||n.isObjectOrArray(e)&&0===Object.keys(e).length)))}return e},l=e.safeJsonParse(i.safeStableStringify(r));for(const e of c){const r=e.split(".");u(l,r)}return y(l)};
1
+ 'use strict';
2
+
3
+ var chunkFJZGG54N_cjs = require('./chunk-FJZGG54N.cjs');
4
+ var chunkJBQMXC5I_cjs = require('./chunk-JBQMXC5I.cjs');
5
+ var chunkZETAZZLD_cjs = require('./chunk-ZETAZZLD.cjs');
6
+ var chunk6JFZL7YE_cjs = require('./chunk-6JFZL7YE.cjs');
7
+ var chunkT7PU2V7X_cjs = require('./chunk-T7PU2V7X.cjs');
8
+ var chunkPZQ6I4JJ_cjs = require('./chunk-PZQ6I4JJ.cjs');
9
+ var findDuplicates = (values) => {
10
+ chunk6JFZL7YE_cjs.assertIsArray(values, {
11
+ message: ({ currentType, validType }) => `First parameter (\`values\`) must be of type \`${validType}\` (array literal or instance), but received: \`${currentType}\`.`
12
+ });
13
+ const duplicates = [];
14
+ values.forEach((item, index) => {
15
+ for (let i = index + 1; i < values.length; i++) {
16
+ if (chunkJBQMXC5I_cjs.isEqual(item, values[i])) {
17
+ if (!duplicates.some((dup) => chunkJBQMXC5I_cjs.isEqual(dup, item))) {
18
+ duplicates.push(item);
19
+ }
20
+ break;
21
+ }
22
+ }
23
+ });
24
+ return duplicates;
25
+ };
26
+ var omitKeys = (object, keysToOmit) => {
27
+ if (!chunkPZQ6I4JJ_cjs.isPlainObject(object)) return {};
28
+ chunk6JFZL7YE_cjs.assertIsArray(keysToOmit, {
29
+ message: ({ currentType, validType }) => `Second parameter (\`keysToOmit\`) must be of type \`${validType}\` (array literal or instance), but received: \`${currentType}\`.`
30
+ });
31
+ const duplicates = findDuplicates(keysToOmit);
32
+ if (duplicates.length > 0) {
33
+ throw new Error(
34
+ `Function "omitKeys" Error: Duplicate keys detected - \`${duplicates}\``
35
+ );
36
+ }
37
+ return Object.fromEntries(
38
+ Object.entries(object).filter(([key]) => !keysToOmit.includes(key))
39
+ );
40
+ };
41
+ var omitKeysDeep = (object, keysToOmit) => {
42
+ if (!chunkPZQ6I4JJ_cjs.isPlainObject(object)) return {};
43
+ chunk6JFZL7YE_cjs.assertIsArray(keysToOmit, {
44
+ message: ({ currentType, validType }) => `Second parameter (\`keysToOmit\`) must be of type \`${validType}\` (array literal or instance), but received: \`${currentType}\`.`
45
+ });
46
+ const duplicates = findDuplicates(keysToOmit);
47
+ if (chunkPZQ6I4JJ_cjs.isNonEmptyArray(duplicates)) {
48
+ throw new Error(
49
+ `Function "omitKeysDeep" Error: Duplicate keys detected - \`${chunkT7PU2V7X_cjs.safeStableStringify(
50
+ duplicates
51
+ )}\`.`
52
+ );
53
+ }
54
+ const omitAtPath = (obj, pathParts) => {
55
+ if (!chunkPZQ6I4JJ_cjs.isObjectOrArray(obj)) return obj;
56
+ const [current, ...rest] = pathParts;
57
+ if (chunkZETAZZLD_cjs.isEmptyArray(rest)) {
58
+ if (chunkPZQ6I4JJ_cjs.isArray(obj)) {
59
+ const index = parseInt(current);
60
+ if (!chunkPZQ6I4JJ_cjs.isNaN(index) && index in obj) {
61
+ obj.splice(index, 1);
62
+ }
63
+ } else {
64
+ delete obj[current];
65
+ }
66
+ } else {
67
+ const next = obj[current];
68
+ if (chunkPZQ6I4JJ_cjs.isObjectOrArray(next)) {
69
+ obj[current] = omitAtPath(next, rest);
70
+ }
71
+ }
72
+ return obj;
73
+ };
74
+ const deepRemoveEmptyObjects = (obj) => {
75
+ if (chunkPZQ6I4JJ_cjs.isArray(obj)) {
76
+ return obj.map(deepRemoveEmptyObjects).filter((item) => !(chunkPZQ6I4JJ_cjs.isObjectOrArray(item) && Object.keys(item).length === 0));
77
+ }
78
+ if (chunkPZQ6I4JJ_cjs.isObjectOrArray(obj)) {
79
+ const cleaned = Object.fromEntries(
80
+ Object.entries(obj).map(([k, v]) => [k, deepRemoveEmptyObjects(v)]).filter(
81
+ ([, v]) => !chunkPZQ6I4JJ_cjs.isUndefined(v) && !(chunkPZQ6I4JJ_cjs.isObjectOrArray(v) && Object.keys(v).length === 0)
82
+ )
83
+ );
84
+ return cleaned;
85
+ }
86
+ return obj;
87
+ };
88
+ const result = chunkFJZGG54N_cjs.safeJsonParse(chunkT7PU2V7X_cjs.safeStableStringify(object));
89
+ for (const key of keysToOmit) {
90
+ const parts = key.split(".");
91
+ omitAtPath(result, parts);
92
+ }
93
+ return deepRemoveEmptyObjects(result);
94
+ };
95
+
96
+ exports.findDuplicates = findDuplicates;
97
+ exports.omitKeys = omitKeys;
98
+ exports.omitKeysDeep = omitKeysDeep;
@@ -1 +1,88 @@
1
- import{isDate as e,isMap as r}from"./chunk-PET42Z7W.js";import{isObjectOrArray as t,isError as n,isSet as f,isArray as i,isUndefined as u}from"./chunk-CMW2TBOQ.js";var o=e=>e instanceof RegExp;function s(e){return e instanceof ArrayBuffer}function g(a,c,l,y=new WeakMap){if(a===c)return!0;if(a!=a&&c!=c)return!0;if(!t(a)||!t(c))return!1;if(y.get(a)===c)return!0;y.set(a,c);const h=(e,r,t,n,f)=>{if(l){const i=l(e,r,t,n,f,y);if(!u(i))return i}return g(e,r,l,y)};if(e(a)&&e(c))return a.getTime()===c.getTime();if(o(a)&&o(c))return a.source===c.source&&a.flags===c.flags;if(n(a)&&n(c))return a.name===c.name&&a.message===c.message;if(ArrayBuffer.isView(a)&&ArrayBuffer.isView(c)){const e=new Uint8Array(a.buffer,a.byteOffset,a.byteLength),r=new Uint8Array(c.buffer,c.byteOffset,c.byteLength);if(e.length!==r.length)return!1;for(let t=0;t<e.length;t++)if(e[t]!==r[t])return!1;return!0}if(s(a)&&s(c)){if(a.byteLength!==c.byteLength)return!1;const e=new Uint8Array(a),r=new Uint8Array(c);for(let t=0;t<e.length;t++)if(e[t]!==r[t])return!1;return!0}if(r(a)&&r(c)){if(a.size!==c.size)return!1;for(const[e,r]of a){if(!c.has(e))return!1;if(!g(r,c.get(e),l,y))return!1}return!0}if(f(a)&&f(c)){if(a.size!==c.size)return!1;for(const e of a){let r=!1;for(const t of c)if(g(e,t,l,y)){r=!0;break}if(!r)return!1}return!0}if(i(a)&&i(c)){if(a.length!==c.length)return!1;for(let e=0;e<a.length;e++)if(!h(a[e],c[e],e,a,c))return!1;return!0}if(Object.getPrototypeOf(a)!==Object.getPrototypeOf(c))return!1;const b=Reflect.ownKeys(a),m=Reflect.ownKeys(c);if(b.length!==m.length)return!1;for(const e of b){if(!h(a[e],c[e],e,a,c))return!1}return!0}function a(e,r){return g(e,r,void 0,new WeakMap)}export{g as baseDeepEqual,s as isArrayBuffer,a as isEqual,o as isRegExp};
1
+ import { isDate, isMap } from './chunk-PET42Z7W.js';
2
+ import { isObjectOrArray, isError, isSet, isArray, isUndefined } from './chunk-CMW2TBOQ.js';
3
+ var isRegExp = (value) => {
4
+ return value instanceof RegExp;
5
+ };
6
+ function isArrayBuffer(value) {
7
+ return value instanceof ArrayBuffer;
8
+ }
9
+ function baseDeepEqual(value, other, customizer, seen = /* @__PURE__ */ new WeakMap()) {
10
+ if (value === other) return true;
11
+ if (value !== value && other !== other) return true;
12
+ if (!isObjectOrArray(value) || !isObjectOrArray(other)) {
13
+ return false;
14
+ }
15
+ if (seen.get(value) === other) return true;
16
+ seen.set(value, other);
17
+ const callCustomizer = (v, o, key, valObj, othObj) => {
18
+ if (customizer) {
19
+ const result = customizer(v, o, key, valObj, othObj, seen);
20
+ if (!isUndefined(result)) return result;
21
+ }
22
+ return baseDeepEqual(v, o, customizer, seen);
23
+ };
24
+ if (isDate(value) && isDate(other)) return value.getTime() === other.getTime();
25
+ if (isRegExp(value) && isRegExp(other))
26
+ return value.source === other.source && value.flags === other.flags;
27
+ if (isError(value) && isError(other))
28
+ return value.name === other.name && value.message === other.message;
29
+ if (ArrayBuffer.isView(value) && ArrayBuffer.isView(other)) {
30
+ const v = new Uint8Array(value.buffer, value.byteOffset, value.byteLength);
31
+ const o = new Uint8Array(other.buffer, other.byteOffset, other.byteLength);
32
+ if (v.length !== o.length) return false;
33
+ for (let i = 0; i < v.length; i++) if (v[i] !== o[i]) return false;
34
+ return true;
35
+ }
36
+ if (isArrayBuffer(value) && isArrayBuffer(other)) {
37
+ if (value.byteLength !== other.byteLength) return false;
38
+ const v = new Uint8Array(value), o = new Uint8Array(other);
39
+ for (let i = 0; i < v.length; i++) if (v[i] !== o[i]) return false;
40
+ return true;
41
+ }
42
+ if (isMap(value) && isMap(other)) {
43
+ if (value.size !== other.size) return false;
44
+ for (const [k, v] of value) {
45
+ if (!other.has(k)) return false;
46
+ if (!baseDeepEqual(v, other.get(k), customizer, seen)) return false;
47
+ }
48
+ return true;
49
+ }
50
+ if (isSet(value) && isSet(other)) {
51
+ if (value.size !== other.size) return false;
52
+ for (const v of value) {
53
+ let matched = false;
54
+ for (const o of other) {
55
+ if (baseDeepEqual(v, o, customizer, seen)) {
56
+ matched = true;
57
+ break;
58
+ }
59
+ }
60
+ if (!matched) return false;
61
+ }
62
+ return true;
63
+ }
64
+ if (isArray(value) && isArray(other)) {
65
+ if (value.length !== other.length) return false;
66
+ for (let i = 0; i < value.length; i++) {
67
+ if (!callCustomizer(value[i], other[i], i, value, other)) return false;
68
+ }
69
+ return true;
70
+ }
71
+ if (Object.getPrototypeOf(value) !== Object.getPrototypeOf(other)) {
72
+ return false;
73
+ }
74
+ const vKeys = Reflect.ownKeys(value);
75
+ const oKeys = Reflect.ownKeys(other);
76
+ if (vKeys.length !== oKeys.length) return false;
77
+ for (const key of vKeys) {
78
+ const vVal = value[key];
79
+ const oVal = other[key];
80
+ if (!callCustomizer(vVal, oVal, key, value, other)) return false;
81
+ }
82
+ return true;
83
+ }
84
+ function isEqual(value, other) {
85
+ return baseDeepEqual(value, other, void 0, /* @__PURE__ */ new WeakMap());
86
+ }
87
+
88
+ export { baseDeepEqual, isArrayBuffer, isEqual, isRegExp };
@@ -1 +1,45 @@
1
- "use strict";var e=require("./chunk-V45XJKHW.cjs"),r=require("./chunk-ZETAZZLD.cjs"),i=require("./chunk-UDA26MCU.cjs"),s=require("./chunk-PZQ6I4JJ.cjs");function t(e){if(s.isNil(e))return;if(!s.isArray(e))return[];return e.reduce((e,i)=>{if(!s.isNil(i))if(s.isArray(i)){const s=t(i);s&&!r.isEmptyArray(s)&&e.push(s)}else e.push(i);return e},[])}exports.filterNilArray=t,exports.toStringArrayUnRecursive=function(r,n={}){s.assertIsPlainObject(n,{message:({currentType:e,validType:r})=>`Second parameter (\`options\`) must be of type \`${r}\`, but received: \`${e}\`.`});const u=!s.hasOwnProp(n,"removeInvalidValue")||n.removeInvalidValue;if(s.assertIsBoolean(u,{message:({currentType:e,validType:r})=>`Parameter \`removeInvalidValue\` property of the \`options\` (second parameter) must be of type \`${r}\`, but received: \`${e}\`.`}),s.isArray(r)){const n=Array.from(r,r=>s.isString(r)||e.isFinite(r)||s.isBoolean(r)||i.isBigInt(r)?String(r):s.isNull(r)?null:void 0);return u?t(n):n}};
1
+ 'use strict';
2
+
3
+ var chunkV45XJKHW_cjs = require('./chunk-V45XJKHW.cjs');
4
+ var chunkZETAZZLD_cjs = require('./chunk-ZETAZZLD.cjs');
5
+ var chunkUDA26MCU_cjs = require('./chunk-UDA26MCU.cjs');
6
+ var chunkPZQ6I4JJ_cjs = require('./chunk-PZQ6I4JJ.cjs');
7
+ function filterNilArray(input) {
8
+ if (chunkPZQ6I4JJ_cjs.isNil(input)) return void 0;
9
+ if (!chunkPZQ6I4JJ_cjs.isArray(input)) return [];
10
+ const filtered = input.reduce((output, element) => {
11
+ if (!chunkPZQ6I4JJ_cjs.isNil(element)) {
12
+ if (chunkPZQ6I4JJ_cjs.isArray(element)) {
13
+ const cleanedNested = filterNilArray(element);
14
+ if (cleanedNested && !chunkZETAZZLD_cjs.isEmptyArray(cleanedNested)) {
15
+ output.push(cleanedNested);
16
+ }
17
+ } else {
18
+ output.push(element);
19
+ }
20
+ }
21
+ return output;
22
+ }, []);
23
+ return filtered;
24
+ }
25
+ function toStringArrayUnRecursive(array, options = {}) {
26
+ chunkPZQ6I4JJ_cjs.assertIsPlainObject(options, {
27
+ message: ({ currentType, validType }) => `Second parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`
28
+ });
29
+ const riv = chunkPZQ6I4JJ_cjs.hasOwnProp(options, "removeInvalidValue") ? options.removeInvalidValue : true;
30
+ chunkPZQ6I4JJ_cjs.assertIsBoolean(riv, {
31
+ message: ({ currentType, validType }) => `Parameter \`removeInvalidValue\` property of the \`options\` (second parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`
32
+ });
33
+ if (chunkPZQ6I4JJ_cjs.isArray(array)) {
34
+ const result = Array.from(array, (x) => {
35
+ if (chunkPZQ6I4JJ_cjs.isString(x) || chunkV45XJKHW_cjs.isFinite(x) || chunkPZQ6I4JJ_cjs.isBoolean(x) || chunkUDA26MCU_cjs.isBigInt(x)) return String(x);
36
+ return chunkPZQ6I4JJ_cjs.isNull(x) ? null : void 0;
37
+ });
38
+ if (riv) return filterNilArray(result);
39
+ return result;
40
+ }
41
+ return void 0;
42
+ }
43
+
44
+ exports.filterNilArray = filterNilArray;
45
+ exports.toStringArrayUnRecursive = toStringArrayUnRecursive;
@@ -1 +1,42 @@
1
- import{isFinite as e}from"./chunk-3IBQ5MOM.js";import{isEmptyArray as r}from"./chunk-6JFCSH7J.js";import{isBigInt as t}from"./chunk-QNKGP5DY.js";import{isNil as o,isArray as n,assertIsPlainObject as u,hasOwnProp as i,assertIsBoolean as m,isString as p,isBoolean as s,isNull as a}from"./chunk-CMW2TBOQ.js";function c(e){if(o(e))return;if(!n(e))return[];return e.reduce((e,t)=>{if(!o(t))if(n(t)){const o=c(t);o&&!r(o)&&e.push(o)}else e.push(t);return e},[])}function f(r,o={}){u(o,{message:({currentType:e,validType:r})=>`Second parameter (\`options\`) must be of type \`${r}\`, but received: \`${e}\`.`});const f=!i(o,"removeInvalidValue")||o.removeInvalidValue;if(m(f,{message:({currentType:e,validType:r})=>`Parameter \`removeInvalidValue\` property of the \`options\` (second parameter) must be of type \`${r}\`, but received: \`${e}\`.`}),n(r)){const o=Array.from(r,r=>p(r)||e(r)||s(r)||t(r)?String(r):a(r)?null:void 0);return f?c(o):o}}export{c as filterNilArray,f as toStringArrayUnRecursive};
1
+ import { isFinite } from './chunk-3IBQ5MOM.js';
2
+ import { isEmptyArray } from './chunk-6JFCSH7J.js';
3
+ import { isBigInt } from './chunk-QNKGP5DY.js';
4
+ import { isNil, isArray, assertIsPlainObject, hasOwnProp, assertIsBoolean, isString, isBoolean, isNull } from './chunk-CMW2TBOQ.js';
5
+ function filterNilArray(input) {
6
+ if (isNil(input)) return void 0;
7
+ if (!isArray(input)) return [];
8
+ const filtered = input.reduce((output, element) => {
9
+ if (!isNil(element)) {
10
+ if (isArray(element)) {
11
+ const cleanedNested = filterNilArray(element);
12
+ if (cleanedNested && !isEmptyArray(cleanedNested)) {
13
+ output.push(cleanedNested);
14
+ }
15
+ } else {
16
+ output.push(element);
17
+ }
18
+ }
19
+ return output;
20
+ }, []);
21
+ return filtered;
22
+ }
23
+ function toStringArrayUnRecursive(array, options = {}) {
24
+ assertIsPlainObject(options, {
25
+ message: ({ currentType, validType }) => `Second parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`
26
+ });
27
+ const riv = hasOwnProp(options, "removeInvalidValue") ? options.removeInvalidValue : true;
28
+ assertIsBoolean(riv, {
29
+ message: ({ currentType, validType }) => `Parameter \`removeInvalidValue\` property of the \`options\` (second parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`
30
+ });
31
+ if (isArray(array)) {
32
+ const result = Array.from(array, (x) => {
33
+ if (isString(x) || isFinite(x) || isBoolean(x) || isBigInt(x)) return String(x);
34
+ return isNull(x) ? null : void 0;
35
+ });
36
+ if (riv) return filterNilArray(result);
37
+ return result;
38
+ }
39
+ return void 0;
40
+ }
41
+
42
+ export { filterNilArray, toStringArrayUnRecursive };
@@ -1 +1,5 @@
1
- var a=a=>a instanceof URL;export{a as isURL};
1
+ var isURL = (value) => {
2
+ return value instanceof URL;
3
+ };
4
+
5
+ export { isURL };
@@ -1 +1,94 @@
1
- import{safeJsonParse as e}from"./chunk-2CQX5CBG.js";import{isEqual as r}from"./chunk-NBZWMBO6.js";import{isEmptyArray as t}from"./chunk-6JFCSH7J.js";import{assertIsArray as n}from"./chunk-CKTLUNWX.js";import{safeStableStringify as o}from"./chunk-PET42Z7W.js";import{isPlainObject as s,isNonEmptyArray as i,isObjectOrArray as c,isArray as a,isNaN as u,isUndefined as m}from"./chunk-CMW2TBOQ.js";var f=e=>{n(e,{message:({currentType:e,validType:r})=>`First parameter (\`values\`) must be of type \`${r}\` (array literal or instance), but received: \`${e}\`.`});const t=[];return e.forEach((n,o)=>{for(let s=o+1;s<e.length;s++)if(r(n,e[s])){t.some(e=>r(e,n))||t.push(n);break}}),t},p=(e,r)=>{if(!s(e))return{};n(r,{message:({currentType:e,validType:r})=>`Second parameter (\`keysToOmit\`) must be of type \`${r}\` (array literal or instance), but received: \`${e}\`.`});const t=f(r);if(t.length>0)throw new Error(`Function "omitKeys" Error: Duplicate keys detected - \`${t}\``);return Object.fromEntries(Object.entries(e).filter(([e])=>!r.includes(e)))},l=(r,p)=>{if(!s(r))return{};n(p,{message:({currentType:e,validType:r})=>`Second parameter (\`keysToOmit\`) must be of type \`${r}\` (array literal or instance), but received: \`${e}\`.`});const l=f(p);if(i(l))throw new Error(`Function "omitKeysDeep" Error: Duplicate keys detected - \`${o(l)}\`.`);const y=(e,r)=>{if(!c(e))return e;const[n,...o]=r;if(t(o))if(a(e)){const r=parseInt(n);!u(r)&&r in e&&e.splice(r,1)}else delete e[n];else{const r=e[n];c(r)&&(e[n]=y(r,o))}return e},d=e=>{if(a(e))return e.map(d).filter(e=>!(c(e)&&0===Object.keys(e).length));if(c(e)){return Object.fromEntries(Object.entries(e).map(([e,r])=>[e,d(r)]).filter(([,e])=>!(m(e)||c(e)&&0===Object.keys(e).length)))}return e},h=e(o(r));for(const e of p){const r=e.split(".");y(h,r)}return d(h)};export{f as findDuplicates,p as omitKeys,l as omitKeysDeep};
1
+ import { safeJsonParse } from './chunk-2CQX5CBG.js';
2
+ import { isEqual } from './chunk-NBZWMBO6.js';
3
+ import { isEmptyArray } from './chunk-6JFCSH7J.js';
4
+ import { assertIsArray } from './chunk-CKTLUNWX.js';
5
+ import { safeStableStringify } from './chunk-PET42Z7W.js';
6
+ import { isPlainObject, isNonEmptyArray, isObjectOrArray, isArray, isNaN, isUndefined } from './chunk-CMW2TBOQ.js';
7
+ var findDuplicates = (values) => {
8
+ assertIsArray(values, {
9
+ message: ({ currentType, validType }) => `First parameter (\`values\`) must be of type \`${validType}\` (array literal or instance), but received: \`${currentType}\`.`
10
+ });
11
+ const duplicates = [];
12
+ values.forEach((item, index) => {
13
+ for (let i = index + 1; i < values.length; i++) {
14
+ if (isEqual(item, values[i])) {
15
+ if (!duplicates.some((dup) => isEqual(dup, item))) {
16
+ duplicates.push(item);
17
+ }
18
+ break;
19
+ }
20
+ }
21
+ });
22
+ return duplicates;
23
+ };
24
+ var omitKeys = (object, keysToOmit) => {
25
+ if (!isPlainObject(object)) return {};
26
+ assertIsArray(keysToOmit, {
27
+ message: ({ currentType, validType }) => `Second parameter (\`keysToOmit\`) must be of type \`${validType}\` (array literal or instance), but received: \`${currentType}\`.`
28
+ });
29
+ const duplicates = findDuplicates(keysToOmit);
30
+ if (duplicates.length > 0) {
31
+ throw new Error(
32
+ `Function "omitKeys" Error: Duplicate keys detected - \`${duplicates}\``
33
+ );
34
+ }
35
+ return Object.fromEntries(
36
+ Object.entries(object).filter(([key]) => !keysToOmit.includes(key))
37
+ );
38
+ };
39
+ var omitKeysDeep = (object, keysToOmit) => {
40
+ if (!isPlainObject(object)) return {};
41
+ assertIsArray(keysToOmit, {
42
+ message: ({ currentType, validType }) => `Second parameter (\`keysToOmit\`) must be of type \`${validType}\` (array literal or instance), but received: \`${currentType}\`.`
43
+ });
44
+ const duplicates = findDuplicates(keysToOmit);
45
+ if (isNonEmptyArray(duplicates)) {
46
+ throw new Error(
47
+ `Function "omitKeysDeep" Error: Duplicate keys detected - \`${safeStableStringify(
48
+ duplicates
49
+ )}\`.`
50
+ );
51
+ }
52
+ const omitAtPath = (obj, pathParts) => {
53
+ if (!isObjectOrArray(obj)) return obj;
54
+ const [current, ...rest] = pathParts;
55
+ if (isEmptyArray(rest)) {
56
+ if (isArray(obj)) {
57
+ const index = parseInt(current);
58
+ if (!isNaN(index) && index in obj) {
59
+ obj.splice(index, 1);
60
+ }
61
+ } else {
62
+ delete obj[current];
63
+ }
64
+ } else {
65
+ const next = obj[current];
66
+ if (isObjectOrArray(next)) {
67
+ obj[current] = omitAtPath(next, rest);
68
+ }
69
+ }
70
+ return obj;
71
+ };
72
+ const deepRemoveEmptyObjects = (obj) => {
73
+ if (isArray(obj)) {
74
+ return obj.map(deepRemoveEmptyObjects).filter((item) => !(isObjectOrArray(item) && Object.keys(item).length === 0));
75
+ }
76
+ if (isObjectOrArray(obj)) {
77
+ const cleaned = Object.fromEntries(
78
+ Object.entries(obj).map(([k, v]) => [k, deepRemoveEmptyObjects(v)]).filter(
79
+ ([, v]) => !isUndefined(v) && !(isObjectOrArray(v) && Object.keys(v).length === 0)
80
+ )
81
+ );
82
+ return cleaned;
83
+ }
84
+ return obj;
85
+ };
86
+ const result = safeJsonParse(safeStableStringify(object));
87
+ for (const key of keysToOmit) {
88
+ const parts = key.split(".");
89
+ omitAtPath(result, parts);
90
+ }
91
+ return deepRemoveEmptyObjects(result);
92
+ };
93
+
94
+ export { findDuplicates, omitKeys, omitKeysDeep };
@@ -1 +1,107 @@
1
- import{isBigInt as e}from"./chunk-QNKGP5DY.js";import{assertIsPlainObject as r,isPlainObject as t,isBoolean as n,isNaN as o,hasOwnProp as s,getPreciseType as i,isUndefined as a,isNumberObject as u,isInfinityNumber as f,isStringObject as p,isBooleanObject as c,isFunction as l,isSymbol as y,isObjectOrArray as d,isSet as m,isArray as b,isNull as v,isNumber as S,isObject as g}from"./chunk-CMW2TBOQ.js";function k(e){return"[object Map]"===Object.prototype.toString.call(e)||e instanceof Map}var h=(e,s={})=>{r(s,{message:({currentType:e,validType:r})=>`Second parameter (\`options\`) must be of type \`${r}\`, but received: \`${e}\`.`});const i=!(!t(s)||!n(s.skipInvalidDate))&&s.skipInvalidDate,a=e instanceof Date;return i?a:a&&!o(e.getTime())},O=(t,O={})=>{r(O,{message:({currentType:e,validType:r})=>`Second parameter (\`options\`) must be of type \`${r}\`, but received: \`${e}\`.`});const $=!!s(O,"pretty")&&O.pretty,T=!s(O,"sortKeys")||O.sortKeys,A=!!s(O,"sortArray")&&O.sortArray,j=!!s(O,"keepUndefined")&&O.keepUndefined;if(!(n(T)&&n(A)&&n($)&&n(j)))throw new TypeError(`Parameters \`sortKeys\`, \`sortArray\`, \`keepUndefined\` and \`pretty\` property of the \`options\` (second parameter) must be of type \`boolean\`, but received: "['sortKeys': \`${i(T)}\`, 'sortArray': \`${i(A)}\`, 'keepUndefined': \`${i(j)}\`, 'pretty': \`${i($)}\`]".`);if(a(t))return j?"undefined":"null";const K=new WeakSet,w=e=>v(e)||!d(e)&&!l(e),C=r=>{if(u(r)){const e=r.valueOf();return o(e)||f(e)?null:e}if(p(r))return r.valueOf();if(c(r))return r.valueOf();if(!l(r)&&!y(r)){if(e(r))return r.toString();if(o(r)||f(r))return null;if(a(r))return j?void 0:null;if(d(r)){if(K.has(r))return"[Circular]";if(K.add(r),h(r))return r.toISOString();if(k(r))return{map:Array.from(r.entries()).map(([e,r])=>[e,C(r)])};if(m(r))return{set:Array.from(r.values()).map(C)};if(b(r)){const e=r.map(C);if(A){const r=[],t=[];for(const n of e)w(n)?r.push(n):t.push(n);return r.sort((e,r)=>S(e)&&S(r)?e-r:String(e).localeCompare(String(r))),[...r,...t]}return e}const e=Object.keys(r);T&&e.sort((e,r)=>{const t=Number(e),n=Number(r);return o(t)||o(n)?e.localeCompare(r):t-n});const t={};if(g(r))for(const n of e){const e=C(r[n]);a(e)||(t[n]=e)}return t}return r}};try{return JSON.stringify(C(t),null,$?2:0)}catch(e){return console.warn("Error in safeStableStringify:",e),"{}"}};export{h as isDate,k as isMap,O as safeStableStringify};
1
+ import { isBigInt } from './chunk-QNKGP5DY.js';
2
+ import { assertIsPlainObject, isPlainObject, isBoolean, isNaN, hasOwnProp, getPreciseType, isUndefined, isNumberObject, isInfinityNumber, isStringObject, isBooleanObject, isFunction, isSymbol, isObjectOrArray, isSet, isArray, isNull, isNumber, isObject } from './chunk-CMW2TBOQ.js';
3
+ function isMap(value) {
4
+ return Object.prototype.toString.call(value) === "[object Map]" || value instanceof Map;
5
+ }
6
+ var isDate = (value, options = {}) => {
7
+ assertIsPlainObject(options, {
8
+ message: ({ currentType, validType }) => `Second parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`
9
+ });
10
+ const skipInvalidDate = isPlainObject(options) && isBoolean(options.skipInvalidDate) ? options.skipInvalidDate : false;
11
+ const instanceDate = value instanceof Date;
12
+ if (skipInvalidDate) return instanceDate;
13
+ return instanceDate && !isNaN(value.getTime());
14
+ };
15
+ var safeStableStringify = (value, options = {}) => {
16
+ assertIsPlainObject(options, {
17
+ message: ({ currentType, validType }) => `Second parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`
18
+ });
19
+ const pretty = hasOwnProp(options, "pretty") ? options.pretty : false;
20
+ const sortKeys = hasOwnProp(options, "sortKeys") ? options.sortKeys : true;
21
+ const sortArray = hasOwnProp(options, "sortArray") ? options.sortArray : false;
22
+ const keepUndefined = hasOwnProp(options, "keepUndefined") ? options.keepUndefined : false;
23
+ if (!isBoolean(sortKeys) || !isBoolean(sortArray) || !isBoolean(pretty) || !isBoolean(keepUndefined)) {
24
+ throw new TypeError(
25
+ `Parameters \`sortKeys\`, \`sortArray\`, \`keepUndefined\` and \`pretty\` property of the \`options\` (second parameter) must be of type \`boolean\`, but received: "['sortKeys': \`${getPreciseType(
26
+ sortKeys
27
+ )}\`, 'sortArray': \`${getPreciseType(
28
+ sortArray
29
+ )}\`, 'keepUndefined': \`${getPreciseType(
30
+ keepUndefined
31
+ )}\`, 'pretty': \`${getPreciseType(pretty)}\`]".`
32
+ );
33
+ }
34
+ if (isUndefined(value)) {
35
+ return keepUndefined ? "undefined" : "null";
36
+ }
37
+ const seen = /* @__PURE__ */ new WeakSet();
38
+ const isPrimitive = (val) => isNull(val) || !isObjectOrArray(val) && !isFunction(val);
39
+ const deepProcess = (val) => {
40
+ if (isNumberObject(val)) {
41
+ const valOf = val.valueOf();
42
+ return isNaN(valOf) || isInfinityNumber(valOf) ? null : valOf;
43
+ }
44
+ if (isStringObject(val)) return val.valueOf();
45
+ if (isBooleanObject(val)) return val.valueOf();
46
+ if (isFunction(val) || isSymbol(val)) return void 0;
47
+ if (isBigInt(val)) return val.toString();
48
+ if (isNaN(val) || isInfinityNumber(val)) return null;
49
+ if (isUndefined(val)) {
50
+ return keepUndefined ? void 0 : null;
51
+ }
52
+ if (isObjectOrArray(val)) {
53
+ if (seen.has(val)) return "[Circular]";
54
+ seen.add(val);
55
+ if (isDate(val)) return val.toISOString();
56
+ if (isMap(val)) {
57
+ return {
58
+ map: Array.from(val.entries()).map(([k, v]) => [k, deepProcess(v)])
59
+ };
60
+ }
61
+ if (isSet(val)) return { set: Array.from(val.values()).map(deepProcess) };
62
+ if (isArray(val)) {
63
+ const processedArr = val.map(deepProcess);
64
+ if (sortArray) {
65
+ const primitives = [];
66
+ const nonPrimitives = [];
67
+ for (const item of processedArr) {
68
+ if (isPrimitive(item)) primitives.push(item);
69
+ else nonPrimitives.push(item);
70
+ }
71
+ primitives.sort((a, b) => {
72
+ if (isNumber(a) && isNumber(b)) return a - b;
73
+ return String(a).localeCompare(String(b));
74
+ });
75
+ return [...primitives, ...nonPrimitives];
76
+ }
77
+ return processedArr;
78
+ }
79
+ const keys = Object.keys(val);
80
+ if (sortKeys) {
81
+ keys.sort((a, b) => {
82
+ const na = Number(a);
83
+ const nb = Number(b);
84
+ if (!isNaN(na) && !isNaN(nb)) return na - nb;
85
+ return a.localeCompare(b);
86
+ });
87
+ }
88
+ const result = {};
89
+ if (isObject(val)) {
90
+ for (const k of keys) {
91
+ const v = deepProcess(val[k]);
92
+ if (!isUndefined(v)) result[k] = v;
93
+ }
94
+ }
95
+ return result;
96
+ }
97
+ return val;
98
+ };
99
+ try {
100
+ return JSON.stringify(deepProcess(value), null, pretty ? 2 : 0);
101
+ } catch (err) {
102
+ console.warn("Error in safeStableStringify:", err);
103
+ return "{}";
104
+ }
105
+ };
106
+
107
+ export { isDate, isMap, safeStableStringify };