@rzl-zone/utils-js 3.4.0 → 3.5.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 (118) hide show
  1. package/LICENSE.md +1 -1
  2. package/README.md +94 -45
  3. package/dist/assertions/index.cjs +41 -1
  4. package/dist/assertions/index.d.ts +11 -2
  5. package/dist/assertions/index.js +14 -1
  6. package/dist/chunk-2CQX5CBG.js +262 -1
  7. package/dist/chunk-2IOOEY45.cjs +30 -1
  8. package/dist/chunk-2WA36TC5.cjs +189 -0
  9. package/dist/chunk-3IBQ5MOM.js +16 -1
  10. package/dist/chunk-3VA554KW.js +34 -1
  11. package/dist/chunk-5757UBXJ.cjs +157 -1
  12. package/dist/chunk-5IGC6PBH.js +33 -1
  13. package/dist/chunk-5KJFVIQT.cjs +65 -1
  14. package/dist/chunk-6JFCSH7J.js +35 -1
  15. package/dist/chunk-6JFZL7YE.cjs +24 -1
  16. package/dist/chunk-7ODAAXX5.cjs +397 -1
  17. package/dist/chunk-BAV5T2E3.cjs +15 -1
  18. package/dist/chunk-CAH33WOQ.cjs +36 -1
  19. package/dist/chunk-CDCERIZ2.js +177 -0
  20. package/dist/chunk-CKTLUNWX.js +22 -1
  21. package/dist/chunk-CMW2TBOQ.js +567 -1
  22. package/dist/chunk-D3ENH7H6.cjs +101 -1
  23. package/dist/chunk-DEZZUYE2.js +152 -1
  24. package/dist/chunk-DVMHRLKP.cjs +16 -1
  25. package/dist/chunk-DWF2R5GD.cjs +225 -1
  26. package/dist/chunk-E55EQK2U.cjs +18 -1
  27. package/dist/chunk-E74U6CYP.cjs +18 -1
  28. package/dist/chunk-EL6A35UR.cjs +64 -1
  29. package/dist/chunk-F6IPNNSJ.cjs +554 -1
  30. package/dist/chunk-FJZGG54N.cjs +267 -1
  31. package/dist/chunk-FWCKOJZM.js +542 -1
  32. package/dist/chunk-FWHNWL2P.cjs +419 -1
  33. package/dist/chunk-GGEADHZO.js +90 -1
  34. package/dist/chunk-GQR4R5WY.js +31 -1
  35. package/dist/chunk-H66AC7GK.cjs +93 -1
  36. package/dist/chunk-HQWOFR56.cjs +33 -1
  37. package/dist/chunk-HYRQMTRH.cjs +24 -1
  38. package/dist/chunk-IRFL4MAX.js +63 -1
  39. package/dist/chunk-IVL7CKVH.cjs +37 -1
  40. package/dist/chunk-IZPBKKPO.js +16 -1
  41. package/dist/chunk-JBQMXC5I.cjs +106 -1
  42. package/dist/chunk-JEQEF5WD.js +95 -1
  43. package/dist/chunk-JMJQCN74.js +370 -1
  44. package/dist/chunk-KHO2SBNA.cjs +16 -1
  45. package/dist/chunk-KVAL5PAG.cjs +26 -1
  46. package/dist/chunk-L5RDAVVH.js +14 -1
  47. package/dist/chunk-LS6U7FAY.cjs +110 -1
  48. package/dist/chunk-NBZWMBO6.js +101 -1
  49. package/dist/chunk-NRF6LWBC.cjs +56 -1
  50. package/dist/chunk-OI5XKNZO.js +53 -1
  51. package/dist/chunk-ONZFBJVW.js +14 -1
  52. package/dist/chunk-OYTYSY7G.js +106 -1
  53. package/dist/chunk-PET42Z7W.js +119 -1
  54. package/dist/chunk-PZQ6I4JJ.cjs +605 -1
  55. package/dist/chunk-QBKAEVYG.js +113 -1
  56. package/dist/chunk-QNKGP5DY.js +14 -1
  57. package/dist/chunk-RIPKY4RU.js +417 -1
  58. package/dist/chunk-RZW35UN5.cjs +116 -1
  59. package/dist/chunk-SBFNXGTJ.js +220 -1
  60. package/dist/chunk-SBKGWRS5.js +22 -1
  61. package/dist/chunk-SIM77PU4.js +59 -1
  62. package/dist/chunk-T2T7K3KR.js +28 -1
  63. package/dist/chunk-T7PU2V7X.cjs +123 -1
  64. package/dist/chunk-UDA26MCU.cjs +16 -1
  65. package/dist/chunk-V45XJKHW.cjs +18 -1
  66. package/dist/chunk-VJDDGRIK.cjs +16 -1
  67. package/dist/chunk-W2WNBUDE.js +16 -1
  68. package/dist/chunk-WVSPXFTY.js +14 -1
  69. package/dist/chunk-XABCB3Y7.cjs +582 -1
  70. package/dist/chunk-XEDXFSGI.js +24 -1
  71. package/dist/chunk-YKPSRP5G.js +571 -1
  72. package/dist/chunk-YWHHVDT4.js +13 -1
  73. package/dist/chunk-ZETAZZLD.cjs +38 -1
  74. package/dist/conversions/index.cjs +104 -1
  75. package/dist/conversions/index.d.ts +10 -1
  76. package/dist/conversions/index.js +25 -1
  77. package/dist/events/index.cjs +32 -1
  78. package/dist/events/index.d.ts +10 -1
  79. package/dist/events/index.js +13 -1
  80. package/dist/formatters/index.cjs +62 -1
  81. package/dist/formatters/index.d.ts +10 -1
  82. package/dist/formatters/index.js +19 -1
  83. package/dist/generators/index.cjs +38 -1
  84. package/dist/generators/index.d.ts +10 -1
  85. package/dist/generators/index.js +15 -1
  86. package/dist/index.d.ts +39 -12
  87. package/dist/{isPlainObject-CEPWPiXh.d.ts → isPlainObject-FWmcJF6k.d.ts} +13 -4
  88. package/dist/next/index.cjs +218 -1
  89. package/dist/next/index.d.ts +10 -1
  90. package/dist/next/index.js +213 -1
  91. package/dist/next/server/index.cjs +43 -1
  92. package/dist/next/server/index.d.ts +10 -1
  93. package/dist/next/server/index.js +41 -1
  94. package/dist/operations/index.cjs +33 -1
  95. package/dist/operations/index.d.ts +10 -1
  96. package/dist/operations/index.js +18 -1
  97. package/dist/parsers/index.cjs +18 -1
  98. package/dist/parsers/index.d.ts +10 -1
  99. package/dist/parsers/index.js +11 -1
  100. package/dist/predicates/index.cjs +299 -1
  101. package/dist/predicates/index.d.ts +13 -4
  102. package/dist/predicates/index.js +24 -1
  103. package/dist/promises/index.cjs +25 -1
  104. package/dist/promises/index.d.ts +10 -1
  105. package/dist/promises/index.js +14 -1
  106. package/dist/rzl-utils.global.js +25 -1
  107. package/dist/strings/index.cjs +82 -1
  108. package/dist/strings/index.d.ts +10 -1
  109. package/dist/strings/index.js +15 -1
  110. package/dist/tailwind/index.cjs +43 -1
  111. package/dist/tailwind/index.d.ts +10 -1
  112. package/dist/tailwind/index.js +12 -1
  113. package/dist/urls/index.cjs +51 -1
  114. package/dist/urls/index.d.ts +10 -1
  115. package/dist/urls/index.js +24 -1
  116. package/package.json +60 -179
  117. package/dist/chunk-JYQTCICM.js +0 -1
  118. package/dist/chunk-YLA3DURS.cjs +0 -1
@@ -1 +1,370 @@
1
- import{isURL as e}from"./chunk-ONZFBJVW.js";import{isTypedArray as r}from"./chunk-5IGC6PBH.js";import{parseCurrencyString as t}from"./chunk-IRFL4MAX.js";import{isEmptyString as n}from"./chunk-W2WNBUDE.js";import{assertIsString as o}from"./chunk-SBKGWRS5.js";import{isEqual as i,isRegExp as u,baseDeepEqual as a}from"./chunk-NBZWMBO6.js";import{isEmptyArray as s}from"./chunk-6JFCSH7J.js";import{safeStableStringify as f,isDate as c,isMap as p}from"./chunk-PET42Z7W.js";import{isArray as m,getPreciseType as h,assertIsBoolean as y,isNonEmptyString as l,assertIsPlainObject as g,isObjectOrArray as b,isFunction as d,isString as v,isNumber as T,isSymbol as $,isSet as j,isPlainObject as S,isNil as w,isBoolean as N,isBuffer as k,isNaN as O,isUndefined as E,isObject as P,isNull as W}from"./chunk-CMW2TBOQ.js";var A=(e,r,t=!1)=>{if(!m(e)||!m(r))throw new TypeError(`Parameters \`array1\` and \`array2\` property of the \`options\` (second parameter) must be of type \`array\`, but received: ['array1': \`${h(e)}\`, 'array2': \`${h(r)}\`].`);if(y(t,{message:({currentType:e,validType:r})=>`Third parameter \`ignoreOrder\` must be of type \`${r}\`, but received: \`${e}\`.`}),!i(e.length,r.length))return!1;const n=e=>{if(!m(e))return e;return e.map(e=>m(e)?n(e):e).sort((e,r)=>{const t=f(e),n=f(r);return t<n?-1:t>n?1:0})},o=t?n(e):e,u=t?n(r):r;return!!i(o.length,u.length)&&o.every((e,r)=>f(e)===f(u[r]))},M=(e,r)=>i(e,r),R=(r,t)=>{if(!e(r)||!e(t))throw new TypeError("Parameters `urlA` and `urlB` (first and second parameter) must be instance of URL.");return r.protocol+"//"+r.host+r.pathname==t.protocol+"//"+t.host+t.pathname},B=(r,t)=>{if(!e(r)||!e(t))throw new TypeError("Parameters `urlA` and `urlB` (first and second parameter) must be instance of URL.");return r.protocol+"//"+r.host+r.pathname+r.search==t.protocol+"//"+t.host+t.pathname+t.search},x=(e,r,t={})=>{if(!l(e)||!m(r))return!1;g(t,{message:({currentType:e,validType:r})=>`Third parameter (\`options\`) must be of type \`${r}\`, but received: \`${e}\`.`});const{exactMatch:n=!1,flags:i="i"}=t;y(n,{message:({currentType:e,validType:r})=>`Parameter \`exactMatch\` property of the \`options\` (third parameter) must be of type \`${r}\`, but received: \`${e}\`.`}),o(i,{message:({currentType:e,validType:r})=>`Parameter \`flags\` property of the \`options\` (third parameter) must be of type \`${r}\`, but received: \`${e}\`.`});const u=r.filter(e=>l(e)).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"));return 0!==u.length&&u.every(r=>new RegExp(n?`(?<!\\S)${r}(?!\\S)`:r,i.includes("u")?i:i+"u").test(e))},z=(e,r,t={})=>{if(!l(e)||!m(r))return!1;g(t,{message:({currentType:e,validType:r})=>`Third parameter (\`options\`) must be of type \`${r}\`, but received: \`${e}\`.`});const{exactMatch:n=!1,flags:i="i"}=t;y(n,{message:({currentType:e,validType:r})=>`Parameter \`exactMatch\` property of the \`options\` (third parameter) must be of type \`${r}\`, but received: \`${e}\`.`}),o(i,{message:({currentType:e,validType:r})=>`Parameter \`flags\` property of the \`options\` (third parameter) must be of type \`${r}\`, but received: \`${e}\`.`});const u=r.filter(e=>l(e)).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"));if(0===u.length)return!1;const a=n?`(?<!\\S)(${u.join("|")})(?!\\S)`:`(${u.join("|")})`;return new RegExp(a,i.includes("u")?i:i+"u").test(e)};function I(e){const r=typeof e;return"string"===r||"number"===r||"symbol"===r}var F=(e,r)=>{if(!b(e))return!1;if(!I(r))throw new TypeError(`Second Parameter (\`key\`) must be of type \`string\`, \`number\` or \`symbol\`, but received: \`${h(r)}\`.`);return!!Object.prototype.hasOwnProperty.call(e,r)||(m(e)?e.some(e=>F(e,r)):Object.values(e).some(e=>b(e)&&F(e,r)))},Z=(e,r)=>{if(!m(e)||!m(r)||s(e)||s(r))return!1;const t=new Set(e);return r.some(e=>t.has(e))},C=e=>"[object Arguments]"===Object.prototype.toString.call(e);function U(e){return"number"==typeof e&&e>-1&&Number.isInteger(e)&&e<=Number.MAX_SAFE_INTEGER}function G(e){return!d(e)&&b(e)&&U(e?.length)}function J(e){return b(e)&&U(e.length)}var L=e=>{if(!v(e)&&!T(e))return!1;return 0!==t(e.toString())||"0"===e.toString().trim()},_=(e,r)=>{if("number"==typeof e&&"number"==typeof r&&Number.isNaN(e)&&Number.isNaN(r))return!0;if(e===r)return!0;if(typeof e!=typeof r)return!1;if(c(e)&&c(r))return e.getTime()===r.getTime();if(u(e)&&u(r))return e.toString()===r.toString();if($(e)&&$(r))return e.toString()===r.toString();if(j(e)&&j(r)){if(e.size!==r.size)return!1;const t=Array.from(r),n=new Set;for(const r of e){let e=!1;for(let o=0;o<t.length;o++)if(!n.has(o)&&_(r,t[o])){n.add(o),e=!0;break}if(!e)return!1}return!0}if(p(e)&&p(r)){if(e.size!==r.size)return!1;const t=Array.from(r),n=new Set;for(const[r,o]of e){let e=!1;for(let i=0;i<t.length;i++){if(n.has(i))continue;const[u,a]=t[i];if(_(r,u)&&_(o,a)){n.add(i),e=!0;break}}if(!e)return!1}return!0}if(m(e)&&m(r))return e.length===r.length&&e.every((e,t)=>_(e,r[t]));if(b(e)&&b(r)&&e&&r){if(m(e)!==m(r))return!1;const t=Object.keys(e),n=Object.keys(r);return t.length===n.length&&t.every(t=>_(e[t],r[t]))}return!1};function H(e){return!!e&&"object"==typeof e&&1===e?.nodeType&&!S(e)}function K(e){return!!w(e)||(!!(N(e)||T(e,{includeNaN:!0})||$(e))||(d(e)?0===Object.keys(e).length:v(e)||m(e)||C(e)||r(e)?0===e.length:p(e)||j(e)?0===e.size:k(e)?0===e.length:!!S(e)&&0===Object.keys(e).length))}var X=e=>{if(v(e))return n(e);if(T(e))return O(e);if(m(e))return s(e)||e.every(X);if(b(e)){const r=Object.keys(e),t=Object.getOwnPropertySymbols(e);return 0===r.length&&0===t.length||[...r,...t].every(r=>X(e[r]))}return!e};function D(e,r,t){return a(e,r,t,new WeakMap)}function Q(e,r,t){return q(e,r,t)}function V(e,r){return e===r||0===e&&0===r||Number.isNaN(e)&&Number.isNaN(r)}function q(e,r,t){if(e===r)return!0;if(!b(r))return V(e,r);if(!b(e))return!1;const n=Reflect.ownKeys(r).filter(e=>!(m(r)&&"length"===e));for(const o of n){if(!(o in e))return!1;const n=e[o],i=r[o],u=t?.(n,i,o,e,r);if(E(u)){if(b(n)&&b(i)){if(!Q(n,i,t))return!1}else if(!V(n,i))return!1}else if(!u)return!1}return!0}function Y(e,r){return q(e,r)}var ee=Function.prototype.toString,re=/\{\s*\[native code\]\s*\}/;function te(e){if(!d(e))return!1;try{const r=ee.call(e);return re.test(r)}catch{return!1}}function ne(e){return!w(e)&&(b(e)||d(e))}function oe(e){return"number"==typeof e&&Number.isSafeInteger(e)}var ie=e=>{if(!l(e))return!1;let r;try{r=decodeURIComponent(e)}catch{return!1}if(!r.startsWith("http://")&&!r.startsWith("https://"))return!1;return new RegExp(/^https?:\/\/(?:localhost(?::\d+)?(?:[\/?#][^\s]*)?|(?:www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}(?::\d+)?(?:[\/?#][^\s]*)?)$/).test(r)};function ue(e){return P(e)&&!W(e)&&e instanceof WeakMap}export{A as areArraysEqual,M as areObjectsEqual,R as areURLsEqualPath,B as areURLsIdentical,Z as arrayHasAnyMatch,F as doesKeyExist,C as isArguments,G as isArrayLike,J as isArrayLikeObject,L as isCurrencyLike,_ as isDeepEqual,H as isElement,K as isEmpty,X as isEmptyDeep,D as isEqualWith,U as isLength,Y as isMatch,Q as isMatchWith,te as isNative,ne as isObjectLoose,I as isPropertyKey,oe as isSafeInteger,ie as isValidURL,ue as isWeakMap,x as textContainsAll,z as textContainsAny};
1
+ /*!
2
+ * ====================================================
3
+ * Rzl Utils-JS.
4
+ * ----------------------------------------------------
5
+ * Version: 3.5.1.
6
+ * Author: Rizalvin Dwiky.
7
+ * Repository: https://github.com/rzl-zone/utils-js.
8
+ * ====================================================
9
+ */
10
+ import { isURL } from './chunk-ONZFBJVW.js';
11
+ import { isTypedArray } from './chunk-5IGC6PBH.js';
12
+ import { parseCurrencyString } from './chunk-IRFL4MAX.js';
13
+ import { isEmptyString } from './chunk-W2WNBUDE.js';
14
+ import { assertIsString } from './chunk-SBKGWRS5.js';
15
+ import { isEqual, isRegExp, baseDeepEqual } from './chunk-NBZWMBO6.js';
16
+ import { isEmptyArray } from './chunk-6JFCSH7J.js';
17
+ import { safeStableStringify, isDate, isMap } from './chunk-PET42Z7W.js';
18
+ import { isArray, getPreciseType, assertIsBoolean, isNonEmptyString, assertIsPlainObject, isObjectOrArray, isFunction, isString, isNumber, isSymbol, isSet, isPlainObject, isNil, isBoolean, isBuffer, isNaN, isUndefined, isObject, isNull } from './chunk-CMW2TBOQ.js';
19
+
20
+ var areArraysEqual = (array1, array2, ignoreOrder = false) => {
21
+ if (!(isArray(array1) && isArray(array2))) {
22
+ throw new TypeError(
23
+ `Parameters \`array1\` and \`array2\` property of the \`options\` (second parameter) must be of type \`array\`, but received: ['array1': \`${getPreciseType(
24
+ array1
25
+ )}\`, 'array2': \`${getPreciseType(array2)}\`].`
26
+ );
27
+ }
28
+ assertIsBoolean(ignoreOrder, {
29
+ message: ({ currentType, validType }) => `Third parameter \`ignoreOrder\` must be of type \`${validType}\`, but received: \`${currentType}\`.`
30
+ });
31
+ if (!isEqual(array1.length, array2.length)) return false;
32
+ const deepIgnoreOrder = (arr) => {
33
+ if (!isArray(arr)) return arr;
34
+ const sorted = arr.map((item) => {
35
+ if (isArray(item)) {
36
+ return deepIgnoreOrder(item);
37
+ }
38
+ return item;
39
+ });
40
+ return sorted.sort((a, b) => {
41
+ const sa = safeStableStringify(a);
42
+ const sb = safeStableStringify(b);
43
+ return sa < sb ? -1 : sa > sb ? 1 : 0;
44
+ });
45
+ };
46
+ const normalizedArr1 = ignoreOrder ? deepIgnoreOrder(array1) : array1;
47
+ const normalizedArr2 = ignoreOrder ? deepIgnoreOrder(array2) : array2;
48
+ if (!isEqual(normalizedArr1.length, normalizedArr2.length)) return false;
49
+ return normalizedArr1.every(
50
+ (item, index) => safeStableStringify(item) === safeStableStringify(normalizedArr2[index])
51
+ );
52
+ };
53
+
54
+ var areObjectsEqual = (object1, object2) => {
55
+ return isEqual(object1, object2);
56
+ };
57
+
58
+ var areURLsEqualPath = (urlA, urlB) => {
59
+ if (!isURL(urlA) || !isURL(urlB)) {
60
+ throw new TypeError(
61
+ `Parameters \`urlA\` and \`urlB\` (first and second parameter) must be instance of URL.`
62
+ );
63
+ }
64
+ return urlA.protocol + "//" + urlA.host + urlA.pathname === urlB.protocol + "//" + urlB.host + urlB.pathname;
65
+ };
66
+
67
+ var areURLsIdentical = (urlA, urlB) => {
68
+ if (!isURL(urlA) || !isURL(urlB)) {
69
+ throw new TypeError(
70
+ `Parameters \`urlA\` and \`urlB\` (first and second parameter) must be instance of URL.`
71
+ );
72
+ }
73
+ return urlA.protocol + "//" + urlA.host + urlA.pathname + urlA.search === urlB.protocol + "//" + urlB.host + urlB.pathname + urlB.search;
74
+ };
75
+
76
+ var textContainsAll = (text, searchWords, options = {}) => {
77
+ if (!isNonEmptyString(text) || !isArray(searchWords)) {
78
+ return false;
79
+ }
80
+ assertIsPlainObject(options, {
81
+ message: ({ currentType, validType }) => `Third parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`
82
+ });
83
+ const { exactMatch = false, flags = "i" } = options;
84
+ assertIsBoolean(exactMatch, {
85
+ message: ({ currentType, validType }) => `Parameter \`exactMatch\` property of the \`options\` (third parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`
86
+ });
87
+ assertIsString(flags, {
88
+ message: ({ currentType, validType }) => `Parameter \`flags\` property of the \`options\` (third parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`
89
+ });
90
+ const escapeRegex = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
91
+ const validSearchWords = searchWords.filter((word) => isNonEmptyString(word)).map(escapeRegex);
92
+ if (validSearchWords.length === 0) return false;
93
+ return validSearchWords.every((word) => {
94
+ const pattern = exactMatch ? `(?<!\\S)${word}(?!\\S)` : word;
95
+ return new RegExp(pattern, flags.includes("u") ? flags : flags + "u").test(text);
96
+ });
97
+ };
98
+
99
+ var textContainsAny = (text, searchWords, options = {}) => {
100
+ if (!isNonEmptyString(text) || !isArray(searchWords)) {
101
+ return false;
102
+ }
103
+ assertIsPlainObject(options, {
104
+ message: ({ currentType, validType }) => `Third parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`
105
+ });
106
+ const { exactMatch = false, flags = "i" } = options;
107
+ assertIsBoolean(exactMatch, {
108
+ message: ({ currentType, validType }) => `Parameter \`exactMatch\` property of the \`options\` (third parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`
109
+ });
110
+ assertIsString(flags, {
111
+ message: ({ currentType, validType }) => `Parameter \`flags\` property of the \`options\` (third parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`
112
+ });
113
+ const escapeRegex = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
114
+ const validSearchWords = searchWords.filter((word) => isNonEmptyString(word)).map(escapeRegex);
115
+ if (validSearchWords.length === 0) return false;
116
+ const pattern = exactMatch ? `(?<!\\S)(${validSearchWords.join("|")})(?!\\S)` : `(${validSearchWords.join("|")})`;
117
+ return new RegExp(pattern, flags.includes("u") ? flags : flags + "u").test(text);
118
+ };
119
+
120
+ function isPropertyKey(value) {
121
+ const type = typeof value;
122
+ return type === "string" || type === "number" || type === "symbol";
123
+ }
124
+
125
+ var doesKeyExist = (object, key) => {
126
+ if (!isObjectOrArray(object)) return false;
127
+ if (!isPropertyKey(key)) {
128
+ throw new TypeError(
129
+ `Second Parameter (\`key\`) must be of type \`string\`, \`number\` or \`symbol\`, but received: \`${getPreciseType(
130
+ key
131
+ )}\`.`
132
+ );
133
+ }
134
+ if (Object.prototype.hasOwnProperty.call(object, key)) return true;
135
+ if (isArray(object)) {
136
+ return object.some((item) => doesKeyExist(item, key));
137
+ }
138
+ return Object.values(object).some(
139
+ (value) => isObjectOrArray(value) && doesKeyExist(value, key)
140
+ );
141
+ };
142
+
143
+ var arrayHasAnyMatch = (sourceArray, targetArray) => {
144
+ if (!isArray(sourceArray) || !isArray(targetArray) || isEmptyArray(sourceArray) || isEmptyArray(targetArray)) {
145
+ return false;
146
+ }
147
+ const sourceSet = new Set(sourceArray);
148
+ return targetArray.some((item) => sourceSet.has(item));
149
+ };
150
+
151
+ var isArguments = (value) => {
152
+ return Object.prototype.toString.call(value) === "[object Arguments]";
153
+ };
154
+
155
+ function isLength(value) {
156
+ return typeof value === "number" && value > -1 && Number.isInteger(value) && value <= Number.MAX_SAFE_INTEGER;
157
+ }
158
+
159
+ function isArrayLike(value) {
160
+ return !isFunction(value) && isObjectOrArray(value) && isLength(value?.length);
161
+ }
162
+
163
+ function isArrayLikeObject(value) {
164
+ return isObjectOrArray(value) && isLength(value.length);
165
+ }
166
+
167
+ var isCurrencyLike = (input) => {
168
+ if (!(isString(input) || isNumber(input))) return false;
169
+ const parsed = parseCurrencyString(input.toString());
170
+ if (parsed !== 0) return true;
171
+ return input.toString().trim() === "0";
172
+ };
173
+
174
+ var isDeepEqual = (a, b) => {
175
+ if (typeof a === "number" && typeof b === "number" && Number.isNaN(a) && Number.isNaN(b)) {
176
+ return true;
177
+ }
178
+ if (a === b) return true;
179
+ if (typeof a !== typeof b) return false;
180
+ if (isDate(a) && isDate(b)) {
181
+ return a.getTime() === b.getTime();
182
+ }
183
+ if (isRegExp(a) && isRegExp(b)) {
184
+ return a.toString() === b.toString();
185
+ }
186
+ if (isSymbol(a) && isSymbol(b)) {
187
+ return a.toString() === b.toString();
188
+ }
189
+ if (isSet(a) && isSet(b)) {
190
+ if (a.size !== b.size) return false;
191
+ const bValues = Array.from(b);
192
+ const matched = /* @__PURE__ */ new Set();
193
+ for (const aVal of a) {
194
+ let found = false;
195
+ for (let i = 0; i < bValues.length; i++) {
196
+ if (matched.has(i)) continue;
197
+ if (isDeepEqual(aVal, bValues[i])) {
198
+ matched.add(i);
199
+ found = true;
200
+ break;
201
+ }
202
+ }
203
+ if (!found) return false;
204
+ }
205
+ return true;
206
+ }
207
+ if (isMap(a) && isMap(b)) {
208
+ if (a.size !== b.size) return false;
209
+ const bEntries = Array.from(b);
210
+ const matched = /* @__PURE__ */ new Set();
211
+ for (const [aKey, aVal] of a) {
212
+ let found = false;
213
+ for (let i = 0; i < bEntries.length; i++) {
214
+ if (matched.has(i)) continue;
215
+ const [bKey, bVal] = bEntries[i];
216
+ if (isDeepEqual(aKey, bKey) && isDeepEqual(aVal, bVal)) {
217
+ matched.add(i);
218
+ found = true;
219
+ break;
220
+ }
221
+ }
222
+ if (!found) return false;
223
+ }
224
+ return true;
225
+ }
226
+ if (isArray(a) && isArray(b)) {
227
+ if (a.length !== b.length) return false;
228
+ return a.every((item, i) => isDeepEqual(item, b[i]));
229
+ }
230
+ if (isObjectOrArray(a) && isObjectOrArray(b) && a && b) {
231
+ if (isArray(a) !== isArray(b)) return false;
232
+ const aKeys = Object.keys(a);
233
+ const bKeys = Object.keys(b);
234
+ if (aKeys.length !== bKeys.length) return false;
235
+ return aKeys.every((key) => isDeepEqual(a[key], b[key]));
236
+ }
237
+ return false;
238
+ };
239
+
240
+ function isElement(value) {
241
+ return !!value && typeof value === "object" && value?.nodeType === 1 && !isPlainObject(value);
242
+ }
243
+
244
+ function isEmpty(value) {
245
+ if (isNil(value)) return true;
246
+ if (isBoolean(value) || isNumber(value, { includeNaN: true }) || isSymbol(value))
247
+ return true;
248
+ if (isFunction(value)) {
249
+ return Object.keys(value).length === 0;
250
+ }
251
+ if (isString(value) || isArray(value) || isArguments(value) || isTypedArray(value)) {
252
+ return value.length === 0;
253
+ }
254
+ if (isMap(value) || isSet(value)) {
255
+ return value.size === 0;
256
+ }
257
+ if (isBuffer(value)) {
258
+ return value.length === 0;
259
+ }
260
+ if (isPlainObject(value)) {
261
+ return Object.keys(value).length === 0;
262
+ }
263
+ return false;
264
+ }
265
+
266
+ var isEmptyDeep = (value) => {
267
+ if (isString(value)) return isEmptyString(value);
268
+ if (isNumber(value)) return isNaN(value);
269
+ if (isArray(value)) {
270
+ return isEmptyArray(value) || value.every(isEmptyDeep);
271
+ }
272
+ if (isObjectOrArray(value)) {
273
+ const keys = Object.keys(value);
274
+ const symbols = Object.getOwnPropertySymbols(value);
275
+ if (keys.length === 0 && symbols.length === 0) return true;
276
+ return [...keys, ...symbols].every((key) => isEmptyDeep(value[key]));
277
+ }
278
+ if (!value) return true;
279
+ return false;
280
+ };
281
+
282
+ function isEqualWith(value, other, customizer) {
283
+ return baseDeepEqual(value, other, customizer, /* @__PURE__ */ new WeakMap());
284
+ }
285
+
286
+ function isMatchWith(value, other, customizer) {
287
+ return baseIsMatch(value, other, customizer);
288
+ }
289
+
290
+ function isSameValue(x, y) {
291
+ return x === y || x === 0 && y === 0 || Number.isNaN(x) && Number.isNaN(y);
292
+ }
293
+ function baseIsMatch(object, source, customizer) {
294
+ if (object === source) return true;
295
+ if (!isObjectOrArray(source)) {
296
+ return isSameValue(object, source);
297
+ }
298
+ if (!isObjectOrArray(object)) {
299
+ return false;
300
+ }
301
+ const keys = Reflect.ownKeys(source).filter(
302
+ (k) => !(isArray(source) && k === "length")
303
+ );
304
+ for (const key of keys) {
305
+ if (!(key in object)) return false;
306
+ const objValue = object[key];
307
+ const srcValue = source[key];
308
+ const result = customizer?.(objValue, srcValue, key, object, source);
309
+ if (!isUndefined(result)) {
310
+ if (!result) return false;
311
+ continue;
312
+ }
313
+ if (isObjectOrArray(objValue) && isObjectOrArray(srcValue)) {
314
+ if (!isMatchWith(objValue, srcValue, customizer)) return false;
315
+ } else {
316
+ if (!isSameValue(objValue, srcValue)) return false;
317
+ }
318
+ }
319
+ return true;
320
+ }
321
+
322
+ function isMatch(object, source) {
323
+ return baseIsMatch(object, source);
324
+ }
325
+
326
+ var funcToString = Function.prototype.toString;
327
+ var reIsNative = /\{\s*\[native code\]\s*\}/;
328
+ function isNative(value) {
329
+ if (!isFunction(value)) return false;
330
+ try {
331
+ const source = funcToString.call(value);
332
+ return reIsNative.test(source);
333
+ } catch {
334
+ return false;
335
+ }
336
+ }
337
+
338
+ function isObjectLoose(value) {
339
+ return !isNil(value) && (isObjectOrArray(value) || isFunction(value));
340
+ }
341
+
342
+ function isSafeInteger(value) {
343
+ return typeof value === "number" && Number.isSafeInteger(value);
344
+ }
345
+
346
+ var isValidURL = (url) => {
347
+ if (!isNonEmptyString(url)) return false;
348
+ let decodedUrl;
349
+ try {
350
+ decodedUrl = decodeURIComponent(url);
351
+ } catch {
352
+ return false;
353
+ }
354
+ if (!decodedUrl.startsWith("http://") && !decodedUrl.startsWith("https://")) {
355
+ return false;
356
+ }
357
+ const urlPattern = new RegExp(
358
+ /^https?:\/\/(?:localhost(?::\d+)?(?:[\/?#][^\s]*)?|(?:www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}(?::\d+)?(?:[\/?#][^\s]*)?)$/
359
+ //! DEPRECATED
360
+ // /^https?:\/\/(?:localhost(?::\d+)?(?:[/?#][^\s]*)?|(?:www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6})(?:[/?#][^\s]*)?$/
361
+ // /^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_+.~#?&/=]*)$/
362
+ );
363
+ return urlPattern.test(decodedUrl);
364
+ };
365
+
366
+ function isWeakMap(value) {
367
+ return isObject(value) && !isNull(value) && value instanceof WeakMap;
368
+ }
369
+
370
+ export { areArraysEqual, areObjectsEqual, areURLsEqualPath, areURLsIdentical, arrayHasAnyMatch, doesKeyExist, isArguments, isArrayLike, isArrayLikeObject, isCurrencyLike, isDeepEqual, isElement, isEmpty, isEmptyDeep, isEqualWith, isLength, isMatch, isMatchWith, isNative, isObjectLoose, isPropertyKey, isSafeInteger, isValidURL, isWeakMap, textContainsAll, textContainsAny };
@@ -1 +1,16 @@
1
- "use strict";exports.isURL=s=>s instanceof URL;
1
+ /*!
2
+ * ====================================================
3
+ * Rzl Utils-JS.
4
+ * ----------------------------------------------------
5
+ * Version: 3.5.1.
6
+ * Author: Rizalvin Dwiky.
7
+ * Repository: https://github.com/rzl-zone/utils-js.
8
+ * ====================================================
9
+ */
10
+ 'use strict';
11
+
12
+ var isURL = (value) => {
13
+ return value instanceof URL;
14
+ };
15
+
16
+ exports.isURL = isURL;
@@ -1 +1,26 @@
1
- "use strict";var r=require("./chunk-PZQ6I4JJ.cjs");exports.removeSpaces=(e,t={trimOnly:!1})=>{if(!r.isNonEmptyString(e))return"";r.isPlainObject(t)||(t={});const{trimOnly:i=!1}=t;return i?e.trim():e.replace(/\s+/g,"")};
1
+ /*!
2
+ * ====================================================
3
+ * Rzl Utils-JS.
4
+ * ----------------------------------------------------
5
+ * Version: 3.5.1.
6
+ * Author: Rizalvin Dwiky.
7
+ * Repository: https://github.com/rzl-zone/utils-js.
8
+ * ====================================================
9
+ */
10
+ 'use strict';
11
+
12
+ var chunkPZQ6I4JJ_cjs = require('./chunk-PZQ6I4JJ.cjs');
13
+
14
+ var removeSpaces = (value, options = {
15
+ trimOnly: false
16
+ }) => {
17
+ if (!chunkPZQ6I4JJ_cjs.isNonEmptyString(value)) return "";
18
+ if (!chunkPZQ6I4JJ_cjs.isPlainObject(options)) {
19
+ options = {};
20
+ }
21
+ const { trimOnly = false } = options;
22
+ if (trimOnly) return value.trim();
23
+ return value.replace(/\s+/g, "");
24
+ };
25
+
26
+ exports.removeSpaces = removeSpaces;
@@ -1 +1,14 @@
1
- var e=()=>"undefined"==typeof window||"undefined"==typeof document;export{e as isServer};
1
+ /*!
2
+ * ====================================================
3
+ * Rzl Utils-JS.
4
+ * ----------------------------------------------------
5
+ * Version: 3.5.1.
6
+ * Author: Rizalvin Dwiky.
7
+ * Repository: https://github.com/rzl-zone/utils-js.
8
+ * ====================================================
9
+ */
10
+ var isServer = () => {
11
+ return typeof window === "undefined" || typeof document === "undefined";
12
+ };
13
+
14
+ export { isServer };
@@ -1 +1,110 @@
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
+ /*!
2
+ * ====================================================
3
+ * Rzl Utils-JS.
4
+ * ----------------------------------------------------
5
+ * Version: 3.5.1.
6
+ * Author: Rizalvin Dwiky.
7
+ * Repository: https://github.com/rzl-zone/utils-js.
8
+ * ====================================================
9
+ */
10
+ 'use strict';
11
+
12
+ var chunkFJZGG54N_cjs = require('./chunk-FJZGG54N.cjs');
13
+ var chunkJBQMXC5I_cjs = require('./chunk-JBQMXC5I.cjs');
14
+ var chunkZETAZZLD_cjs = require('./chunk-ZETAZZLD.cjs');
15
+ var chunk6JFZL7YE_cjs = require('./chunk-6JFZL7YE.cjs');
16
+ var chunkT7PU2V7X_cjs = require('./chunk-T7PU2V7X.cjs');
17
+ var chunkPZQ6I4JJ_cjs = require('./chunk-PZQ6I4JJ.cjs');
18
+
19
+ var findDuplicates = (values) => {
20
+ chunk6JFZL7YE_cjs.assertIsArray(values, {
21
+ message: ({ currentType, validType }) => `First parameter (\`values\`) must be of type \`${validType}\` (array literal or instance), but received: \`${currentType}\`.`
22
+ });
23
+ const duplicates = [];
24
+ values.forEach((item, index) => {
25
+ for (let i = index + 1; i < values.length; i++) {
26
+ if (chunkJBQMXC5I_cjs.isEqual(item, values[i])) {
27
+ if (!duplicates.some((dup) => chunkJBQMXC5I_cjs.isEqual(dup, item))) {
28
+ duplicates.push(item);
29
+ }
30
+ break;
31
+ }
32
+ }
33
+ });
34
+ return duplicates;
35
+ };
36
+
37
+ var omitKeys = (object, keysToOmit) => {
38
+ if (!chunkPZQ6I4JJ_cjs.isPlainObject(object)) return {};
39
+ chunk6JFZL7YE_cjs.assertIsArray(keysToOmit, {
40
+ message: ({ currentType, validType }) => `Second parameter (\`keysToOmit\`) must be of type \`${validType}\` (array literal or instance), but received: \`${currentType}\`.`
41
+ });
42
+ const duplicates = findDuplicates(keysToOmit);
43
+ if (duplicates.length > 0) {
44
+ throw new Error(
45
+ `Function "omitKeys" Error: Duplicate keys detected - \`${duplicates}\``
46
+ );
47
+ }
48
+ return Object.fromEntries(
49
+ Object.entries(object).filter(([key]) => !keysToOmit.includes(key))
50
+ );
51
+ };
52
+
53
+ var omitKeysDeep = (object, keysToOmit) => {
54
+ if (!chunkPZQ6I4JJ_cjs.isPlainObject(object)) return {};
55
+ chunk6JFZL7YE_cjs.assertIsArray(keysToOmit, {
56
+ message: ({ currentType, validType }) => `Second parameter (\`keysToOmit\`) must be of type \`${validType}\` (array literal or instance), but received: \`${currentType}\`.`
57
+ });
58
+ const duplicates = findDuplicates(keysToOmit);
59
+ if (chunkPZQ6I4JJ_cjs.isNonEmptyArray(duplicates)) {
60
+ throw new Error(
61
+ `Function "omitKeysDeep" Error: Duplicate keys detected - \`${chunkT7PU2V7X_cjs.safeStableStringify(
62
+ duplicates
63
+ )}\`.`
64
+ );
65
+ }
66
+ const omitAtPath = (obj, pathParts) => {
67
+ if (!chunkPZQ6I4JJ_cjs.isObjectOrArray(obj)) return obj;
68
+ const [current, ...rest] = pathParts;
69
+ if (chunkZETAZZLD_cjs.isEmptyArray(rest)) {
70
+ if (chunkPZQ6I4JJ_cjs.isArray(obj)) {
71
+ const index = parseInt(current);
72
+ if (!chunkPZQ6I4JJ_cjs.isNaN(index) && index in obj) {
73
+ obj.splice(index, 1);
74
+ }
75
+ } else {
76
+ delete obj[current];
77
+ }
78
+ } else {
79
+ const next = obj[current];
80
+ if (chunkPZQ6I4JJ_cjs.isObjectOrArray(next)) {
81
+ obj[current] = omitAtPath(next, rest);
82
+ }
83
+ }
84
+ return obj;
85
+ };
86
+ const deepRemoveEmptyObjects = (obj) => {
87
+ if (chunkPZQ6I4JJ_cjs.isArray(obj)) {
88
+ return obj.map(deepRemoveEmptyObjects).filter((item) => !(chunkPZQ6I4JJ_cjs.isObjectOrArray(item) && Object.keys(item).length === 0));
89
+ }
90
+ if (chunkPZQ6I4JJ_cjs.isObjectOrArray(obj)) {
91
+ const cleaned = Object.fromEntries(
92
+ Object.entries(obj).map(([k, v]) => [k, deepRemoveEmptyObjects(v)]).filter(
93
+ ([, v]) => !chunkPZQ6I4JJ_cjs.isUndefined(v) && !(chunkPZQ6I4JJ_cjs.isObjectOrArray(v) && Object.keys(v).length === 0)
94
+ )
95
+ );
96
+ return cleaned;
97
+ }
98
+ return obj;
99
+ };
100
+ const result = chunkFJZGG54N_cjs.safeJsonParse(chunkT7PU2V7X_cjs.safeStableStringify(object));
101
+ for (const key of keysToOmit) {
102
+ const parts = key.split(".");
103
+ omitAtPath(result, parts);
104
+ }
105
+ return deepRemoveEmptyObjects(result);
106
+ };
107
+
108
+ exports.findDuplicates = findDuplicates;
109
+ exports.omitKeys = omitKeys;
110
+ exports.omitKeysDeep = omitKeysDeep;
@@ -1 +1,101 @@
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
+ /*!
2
+ * ====================================================
3
+ * Rzl Utils-JS.
4
+ * ----------------------------------------------------
5
+ * Version: 3.5.1.
6
+ * Author: Rizalvin Dwiky.
7
+ * Repository: https://github.com/rzl-zone/utils-js.
8
+ * ====================================================
9
+ */
10
+ import { isDate, isMap } from './chunk-PET42Z7W.js';
11
+ import { isObjectOrArray, isError, isSet, isArray, isUndefined } from './chunk-CMW2TBOQ.js';
12
+
13
+ var isRegExp = (value) => {
14
+ return value instanceof RegExp;
15
+ };
16
+
17
+ function isArrayBuffer(value) {
18
+ return value instanceof ArrayBuffer;
19
+ }
20
+
21
+ function baseDeepEqual(value, other, customizer, seen = /* @__PURE__ */ new WeakMap()) {
22
+ if (value === other) return true;
23
+ if (value !== value && other !== other) return true;
24
+ if (!isObjectOrArray(value) || !isObjectOrArray(other)) {
25
+ return false;
26
+ }
27
+ if (seen.get(value) === other) return true;
28
+ seen.set(value, other);
29
+ const callCustomizer = (v, o, key, valObj, othObj) => {
30
+ if (customizer) {
31
+ const result = customizer(v, o, key, valObj, othObj, seen);
32
+ if (!isUndefined(result)) return result;
33
+ }
34
+ return baseDeepEqual(v, o, customizer, seen);
35
+ };
36
+ if (isDate(value) && isDate(other)) return value.getTime() === other.getTime();
37
+ if (isRegExp(value) && isRegExp(other))
38
+ return value.source === other.source && value.flags === other.flags;
39
+ if (isError(value) && isError(other))
40
+ return value.name === other.name && value.message === other.message;
41
+ if (ArrayBuffer.isView(value) && ArrayBuffer.isView(other)) {
42
+ const v = new Uint8Array(value.buffer, value.byteOffset, value.byteLength);
43
+ const o = new Uint8Array(other.buffer, other.byteOffset, other.byteLength);
44
+ if (v.length !== o.length) return false;
45
+ for (let i = 0; i < v.length; i++) if (v[i] !== o[i]) return false;
46
+ return true;
47
+ }
48
+ if (isArrayBuffer(value) && isArrayBuffer(other)) {
49
+ if (value.byteLength !== other.byteLength) return false;
50
+ const v = new Uint8Array(value), o = new Uint8Array(other);
51
+ for (let i = 0; i < v.length; i++) if (v[i] !== o[i]) return false;
52
+ return true;
53
+ }
54
+ if (isMap(value) && isMap(other)) {
55
+ if (value.size !== other.size) return false;
56
+ for (const [k, v] of value) {
57
+ if (!other.has(k)) return false;
58
+ if (!baseDeepEqual(v, other.get(k), customizer, seen)) return false;
59
+ }
60
+ return true;
61
+ }
62
+ if (isSet(value) && isSet(other)) {
63
+ if (value.size !== other.size) return false;
64
+ for (const v of value) {
65
+ let matched = false;
66
+ for (const o of other) {
67
+ if (baseDeepEqual(v, o, customizer, seen)) {
68
+ matched = true;
69
+ break;
70
+ }
71
+ }
72
+ if (!matched) return false;
73
+ }
74
+ return true;
75
+ }
76
+ if (isArray(value) && isArray(other)) {
77
+ if (value.length !== other.length) return false;
78
+ for (let i = 0; i < value.length; i++) {
79
+ if (!callCustomizer(value[i], other[i], i, value, other)) return false;
80
+ }
81
+ return true;
82
+ }
83
+ if (Object.getPrototypeOf(value) !== Object.getPrototypeOf(other)) {
84
+ return false;
85
+ }
86
+ const vKeys = Reflect.ownKeys(value);
87
+ const oKeys = Reflect.ownKeys(other);
88
+ if (vKeys.length !== oKeys.length) return false;
89
+ for (const key of vKeys) {
90
+ const vVal = value[key];
91
+ const oVal = other[key];
92
+ if (!callCustomizer(vVal, oVal, key, value, other)) return false;
93
+ }
94
+ return true;
95
+ }
96
+
97
+ function isEqual(value, other) {
98
+ return baseDeepEqual(value, other, void 0, /* @__PURE__ */ new WeakMap());
99
+ }
100
+
101
+ export { baseDeepEqual, isArrayBuffer, isEqual, isRegExp };