umt 2.6.0 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/README.md +25 -0
  2. package/module/Crypto/decodeBase32.d.ts +7 -0
  3. package/module/Crypto/decodeBase32.js +27 -0
  4. package/module/Crypto/decodeBase32.js.map +1 -0
  5. package/module/Crypto/decodeBase32ToString.d.ts +7 -0
  6. package/module/Crypto/decodeBase32ToString.js +11 -0
  7. package/module/Crypto/decodeBase32ToString.js.map +1 -0
  8. package/module/Crypto/decodeBase58.d.ts +7 -0
  9. package/module/Crypto/decodeBase58.js +34 -0
  10. package/module/Crypto/decodeBase58.js.map +1 -0
  11. package/module/Crypto/decodeBase58ToString.d.ts +7 -0
  12. package/module/Crypto/decodeBase58ToString.js +11 -0
  13. package/module/Crypto/decodeBase58ToString.js.map +1 -0
  14. package/module/Crypto/encodeBase32.d.ts +7 -0
  15. package/module/Crypto/encodeBase32.js +28 -0
  16. package/module/Crypto/encodeBase32.js.map +1 -0
  17. package/module/Crypto/encodeBase58.d.ts +7 -0
  18. package/module/Crypto/encodeBase58.js +29 -0
  19. package/module/Crypto/encodeBase58.js.map +1 -0
  20. package/module/Crypto/index.d.ts +6 -0
  21. package/module/Crypto/index.js +7 -0
  22. package/module/Crypto/index.js.map +1 -0
  23. package/module/DataStructure/index.d.ts +1 -0
  24. package/module/DataStructure/index.js +2 -0
  25. package/module/DataStructure/index.js.map +1 -0
  26. package/module/DataStructure/priorityQueue.d.ts +241 -0
  27. package/module/DataStructure/priorityQueue.js +327 -0
  28. package/module/DataStructure/priorityQueue.js.map +1 -0
  29. package/module/Math/correlationCoefficient.d.ts +11 -0
  30. package/module/Math/correlationCoefficient.js +40 -0
  31. package/module/Math/correlationCoefficient.js.map +1 -0
  32. package/module/Math/index.d.ts +3 -0
  33. package/module/Math/index.js +3 -0
  34. package/module/Math/index.js.map +1 -1
  35. package/module/Math/mode.d.ts +10 -0
  36. package/module/Math/mode.js +31 -0
  37. package/module/Math/mode.js.map +1 -0
  38. package/module/Math/percentile.d.ts +11 -0
  39. package/module/Math/percentile.js +31 -0
  40. package/module/Math/percentile.js.map +1 -0
  41. package/module/String/fuzzySearch.d.ts +14 -0
  42. package/module/String/fuzzySearch.js +27 -0
  43. package/module/String/fuzzySearch.js.map +1 -0
  44. package/module/String/index.d.ts +4 -0
  45. package/module/String/index.js +4 -0
  46. package/module/String/index.js.map +1 -1
  47. package/module/String/slugify.d.ts +10 -0
  48. package/module/String/slugify.js +21 -0
  49. package/module/String/slugify.js.map +1 -0
  50. package/module/String/truncate.d.ts +12 -0
  51. package/module/String/truncate.js +21 -0
  52. package/module/String/truncate.js.map +1 -0
  53. package/module/String/unescapeHtml.d.ts +17 -0
  54. package/module/String/unescapeHtml.js +45 -0
  55. package/module/String/unescapeHtml.js.map +1 -0
  56. package/module/Validate/index.d.ts +1 -0
  57. package/module/Validate/index.js +1 -0
  58. package/module/Validate/index.js.map +1 -1
  59. package/module/Validate/isDeepEqual.d.ts +28 -0
  60. package/module/Validate/isDeepEqual.js +148 -0
  61. package/module/Validate/isDeepEqual.js.map +1 -0
  62. package/module/es5/Crypto/decodeBase32.d.ts +7 -0
  63. package/module/es5/Crypto/decodeBase32.js +44 -0
  64. package/module/es5/Crypto/decodeBase32ToString.d.ts +7 -0
  65. package/module/es5/Crypto/decodeBase32ToString.js +16 -0
  66. package/module/es5/Crypto/decodeBase58.d.ts +7 -0
  67. package/module/es5/Crypto/decodeBase58.js +63 -0
  68. package/module/es5/Crypto/decodeBase58ToString.d.ts +7 -0
  69. package/module/es5/Crypto/decodeBase58ToString.js +16 -0
  70. package/module/es5/Crypto/encodeBase32.d.ts +7 -0
  71. package/module/es5/Crypto/encodeBase32.js +45 -0
  72. package/module/es5/Crypto/encodeBase58.d.ts +7 -0
  73. package/module/es5/Crypto/encodeBase58.js +55 -0
  74. package/module/es5/Crypto/index.d.ts +6 -0
  75. package/module/es5/Crypto/index.js +71 -0
  76. package/module/es5/DataStructure/index.d.ts +1 -0
  77. package/module/es5/DataStructure/index.js +16 -0
  78. package/module/es5/DataStructure/priorityQueue.d.ts +241 -0
  79. package/module/es5/DataStructure/priorityQueue.js +405 -0
  80. package/module/es5/Math/correlationCoefficient.d.ts +11 -0
  81. package/module/es5/Math/correlationCoefficient.js +63 -0
  82. package/module/es5/Math/index.d.ts +3 -0
  83. package/module/es5/Math/index.js +33 -0
  84. package/module/es5/Math/mode.d.ts +10 -0
  85. package/module/es5/Math/mode.js +67 -0
  86. package/module/es5/Math/percentile.d.ts +11 -0
  87. package/module/es5/Math/percentile.js +42 -0
  88. package/module/es5/String/fuzzySearch.d.ts +14 -0
  89. package/module/es5/String/fuzzySearch.js +50 -0
  90. package/module/es5/String/index.d.ts +4 -0
  91. package/module/es5/String/index.js +44 -0
  92. package/module/es5/String/slugify.d.ts +10 -0
  93. package/module/es5/String/slugify.js +18 -0
  94. package/module/es5/String/truncate.d.ts +12 -0
  95. package/module/es5/String/truncate.js +27 -0
  96. package/module/es5/String/unescapeHtml.d.ts +17 -0
  97. package/module/es5/String/unescapeHtml.js +51 -0
  98. package/module/es5/Validate/index.d.ts +1 -0
  99. package/module/es5/Validate/index.js +11 -0
  100. package/module/es5/Validate/isDeepEqual.d.ts +28 -0
  101. package/module/es5/Validate/isDeepEqual.js +232 -0
  102. package/module/es5/index.d.ts +2 -0
  103. package/module/es5/index.js +22 -0
  104. package/module/es5/tsconfig.tsbuildinfo +1 -1
  105. package/module/index.d.ts +2 -0
  106. package/module/index.js +2 -0
  107. package/module/index.js.map +1 -1
  108. package/package.json +28 -28
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Convert a string to a URL-friendly slug
3
+ * @param str - The string to convert
4
+ * @returns The slugified string
5
+ * @example
6
+ * slugify("Hello World!"); // "hello-world"
7
+ * slugify("This is a Test"); // "this-is-a-test"
8
+ * slugify("Japanese: こんにちは"); // "japanese"
9
+ */
10
+ export const slugify = (string_) => {
11
+ return string_
12
+ .normalize("NFD")
13
+ .replaceAll(/[\u0300-\u036F]/g, "")
14
+ .toLowerCase()
15
+ .replaceAll(/[^\w\s-]/g, "-")
16
+ .replaceAll(/\s+/g, "-")
17
+ .replaceAll(/_+/g, "-")
18
+ .replaceAll(/-+/g, "-")
19
+ .replaceAll(/^-+|-+$/g, "");
20
+ };
21
+ //# sourceMappingURL=slugify.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slugify.js","sourceRoot":"","sources":["../../src/String/slugify.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,OAAe,EAAU,EAAE;IACjD,OAAO,OAAO;SACX,SAAS,CAAC,KAAK,CAAC;SAChB,UAAU,CAAC,kBAAkB,EAAE,EAAE,CAAC;SAClC,WAAW,EAAE;SACb,UAAU,CAAC,WAAW,EAAE,GAAG,CAAC;SAC5B,UAAU,CAAC,MAAM,EAAE,GAAG,CAAC;SACvB,UAAU,CAAC,KAAK,EAAE,GAAG,CAAC;SACtB,UAAU,CAAC,KAAK,EAAE,GAAG,CAAC;SACtB,UAAU,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;AAChC,CAAC,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Truncate a string to a specified length
3
+ * @param str - The string to truncate
4
+ * @param length - The maximum length
5
+ * @param suffix - The suffix to add when truncating (default: "...")
6
+ * @returns The truncated string
7
+ * @example
8
+ * truncate("Hello World", 5); // "Hello..."
9
+ * truncate("Hello World", 5, "~"); // "Hello~"
10
+ * truncate("Hello", 10); // "Hello"
11
+ */
12
+ export declare const truncate: (string_: string, length: number, suffix?: string) => string;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Truncate a string to a specified length
3
+ * @param str - The string to truncate
4
+ * @param length - The maximum length
5
+ * @param suffix - The suffix to add when truncating (default: "...")
6
+ * @returns The truncated string
7
+ * @example
8
+ * truncate("Hello World", 5); // "Hello..."
9
+ * truncate("Hello World", 5, "~"); // "Hello~"
10
+ * truncate("Hello", 10); // "Hello"
11
+ */
12
+ export const truncate = (string_, length, suffix = "...") => {
13
+ if (length < 0) {
14
+ throw new Error("Length must be non-negative");
15
+ }
16
+ if (string_.length <= length) {
17
+ return string_;
18
+ }
19
+ return string_.slice(0, length) + suffix;
20
+ };
21
+ //# sourceMappingURL=truncate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"truncate.js","sourceRoot":"","sources":["../../src/String/truncate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CACtB,OAAe,EACf,MAAc,EACd,MAAM,GAAG,KAAK,EACN,EAAE;IACV,IAAI,MAAM,GAAG,CAAC,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;IACjD,CAAC;IAED,IAAI,OAAO,CAAC,MAAM,IAAI,MAAM,EAAE,CAAC;QAC7B,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC;AAC3C,CAAC,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Unescapes HTML entities in a string
3
+ * @param string_ - The string to unescape
4
+ * @returns The unescaped string with HTML entities converted back to their original characters
5
+ * @example
6
+ * ```typescript
7
+ * unescapeHtml("&lt;script&gt;alert(&quot;Hello&quot;);&lt;/script&gt;");
8
+ * // Returns: "<script>alert("Hello");</script>"
9
+ *
10
+ * unescapeHtml("Tom &amp; Jerry");
11
+ * // Returns: "Tom & Jerry"
12
+ *
13
+ * unescapeHtml("5 &lt; 10 &amp;&amp; 10 &gt; 5");
14
+ * // Returns: "5 < 10 && 10 > 5"
15
+ * ```
16
+ */
17
+ export declare const unescapeHtml: (string_: string) => string;
@@ -0,0 +1,45 @@
1
+ /**
2
+ * HTML entities map for unescaping
3
+ */
4
+ const htmlUnescapeMap = {
5
+ "&amp;": "&",
6
+ "&lt;": "<",
7
+ "&gt;": ">",
8
+ "&quot;": '"',
9
+ "&#39;": "'",
10
+ "&#x27;": "'",
11
+ "&#x2F;": "/",
12
+ "&#x60;": "`",
13
+ "&#x3D;": "=",
14
+ };
15
+ /**
16
+ * Unescapes HTML entities in a string
17
+ * @param string_ - The string to unescape
18
+ * @returns The unescaped string with HTML entities converted back to their original characters
19
+ * @example
20
+ * ```typescript
21
+ * unescapeHtml("&lt;script&gt;alert(&quot;Hello&quot;);&lt;/script&gt;");
22
+ * // Returns: "<script>alert("Hello");</script>"
23
+ *
24
+ * unescapeHtml("Tom &amp; Jerry");
25
+ * // Returns: "Tom & Jerry"
26
+ *
27
+ * unescapeHtml("5 &lt; 10 &amp;&amp; 10 &gt; 5");
28
+ * // Returns: "5 < 10 && 10 > 5"
29
+ * ```
30
+ */
31
+ export const unescapeHtml = (string_) => {
32
+ const entityRegex = /&(?:amp|lt|gt|quot|#39|#x27|#x2F|#x60|#x3D);|&#(\d*);|&#x([0-9a-fA-F]*);/g;
33
+ return string_.replaceAll(entityRegex, (match, dec, hex) => {
34
+ if (dec !== undefined) {
35
+ const codePoint = Number.parseInt(dec, 10);
36
+ return Number.isNaN(codePoint) ? match : String.fromCodePoint(codePoint);
37
+ }
38
+ if (hex !== undefined) {
39
+ const codePoint = Number.parseInt(hex, 16);
40
+ return Number.isNaN(codePoint) ? match : String.fromCodePoint(codePoint);
41
+ }
42
+ return htmlUnescapeMap[match];
43
+ });
44
+ };
45
+ //# sourceMappingURL=unescapeHtml.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unescapeHtml.js","sourceRoot":"","sources":["../../src/String/unescapeHtml.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,eAAe,GAA2B;IAC9C,OAAO,EAAE,GAAG;IACZ,MAAM,EAAE,GAAG;IACX,MAAM,EAAE,GAAG;IACX,QAAQ,EAAE,GAAG;IACb,OAAO,EAAE,GAAG;IACZ,QAAQ,EAAE,GAAG;IACb,QAAQ,EAAE,GAAG;IACb,QAAQ,EAAE,GAAG;IACb,QAAQ,EAAE,GAAG;CACd,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,OAAe,EAAU,EAAE;IACtD,MAAM,WAAW,GACf,2EAA2E,CAAC;IAE9E,OAAO,OAAO,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE;QACzD,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;YACtB,MAAM,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;YAC3C,OAAO,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;QAC3E,CAAC;QACD,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;YACtB,MAAM,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;YAC3C,OAAO,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;QAC3E,CAAC;QACD,OAAO,eAAe,CAAC,KAAK,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC"}
@@ -3,6 +3,7 @@ export * from "./boolean";
3
3
  export * from "./number";
4
4
  export * from "./object";
5
5
  export * from "./string";
6
+ export * from "./isDeepEqual";
6
7
  export * from "./isArray";
7
8
  export * from "./isBrowser";
8
9
  export * from "./isBun";
@@ -5,6 +5,7 @@ export * from "./number";
5
5
  export * from "./object";
6
6
  export * from "./string";
7
7
  // Other Validate
8
+ export * from "./isDeepEqual";
8
9
  export * from "./isArray";
9
10
  export * from "./isBrowser";
10
11
  export * from "./isBun";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Validate/index.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AAEzB,iBAAiB;AACjB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,sBAAsB,CAAC;AACrC,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Validate/index.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AAEzB,iBAAiB;AACjB,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,sBAAsB,CAAC;AACrC,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Options for isDeepEqual comparison
3
+ */
4
+ export interface IsDeepEqualOptions {
5
+ /**
6
+ * Whether to ignore array order when comparing arrays
7
+ * @default true
8
+ */
9
+ strictOrder?: boolean;
10
+ }
11
+ /**
12
+ * Performs a deep equality comparison between two values
13
+ *
14
+ * @param a - First value to compare
15
+ * @param b - Second value to compare
16
+ * @param options - Comparison options
17
+ * @returns true if values are deeply equal, false otherwise
18
+ *
19
+ * @example
20
+ * ```typescript
21
+ * isDeepEqual({ a: 1, b: [2, 3] }, { b: [2, 3], a: 1 }); // true
22
+ * isDeepEqual([1, 2, 3], [3, 2, 1]); // false
23
+ * isDeepEqual([1, 2, 3], [3, 2, 1], { strictOrder: false }); // true
24
+ * isDeepEqual(new Set([1, 2]), new Set([2, 1])); // true
25
+ * isDeepEqual(new Map([['a', 1]]), new Map([['a', 1]])); // true
26
+ * ```
27
+ */
28
+ export declare function isDeepEqual(a: unknown, b: unknown, options?: IsDeepEqualOptions): boolean;
@@ -0,0 +1,148 @@
1
+ /**
2
+ * Performs a deep equality comparison between two values
3
+ *
4
+ * @param a - First value to compare
5
+ * @param b - Second value to compare
6
+ * @param options - Comparison options
7
+ * @returns true if values are deeply equal, false otherwise
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * isDeepEqual({ a: 1, b: [2, 3] }, { b: [2, 3], a: 1 }); // true
12
+ * isDeepEqual([1, 2, 3], [3, 2, 1]); // false
13
+ * isDeepEqual([1, 2, 3], [3, 2, 1], { strictOrder: false }); // true
14
+ * isDeepEqual(new Set([1, 2]), new Set([2, 1])); // true
15
+ * isDeepEqual(new Map([['a', 1]]), new Map([['a', 1]])); // true
16
+ * ```
17
+ */
18
+ export function isDeepEqual(a, b, options = {}) {
19
+ const { strictOrder = true } = options;
20
+ const visited = new WeakSet();
21
+ function compare(x, y) {
22
+ if (Object.is(x, y)) {
23
+ return true;
24
+ }
25
+ if (x == null || y == null) {
26
+ return false;
27
+ }
28
+ if (typeof x !== typeof y) {
29
+ return false;
30
+ }
31
+ if (typeof x !== "object" || typeof y !== "object") {
32
+ return false;
33
+ }
34
+ if (visited.has(x) || visited.has(y)) {
35
+ return true;
36
+ }
37
+ visited.add(x);
38
+ visited.add(y);
39
+ const ctorX = x.constructor;
40
+ const ctorY = y.constructor;
41
+ if (ctorX !== ctorY) {
42
+ return false;
43
+ }
44
+ if (x instanceof Date && y instanceof Date) {
45
+ return x.getTime() === y.getTime();
46
+ }
47
+ if (x instanceof RegExp && y instanceof RegExp) {
48
+ return x.toString() === y.toString();
49
+ }
50
+ if (Array.isArray(x) && Array.isArray(y)) {
51
+ if (x.length !== y.length) {
52
+ return false;
53
+ }
54
+ if (strictOrder) {
55
+ for (const [index, element] of x.entries()) {
56
+ if (!compare(element, y[index])) {
57
+ return false;
58
+ }
59
+ }
60
+ }
61
+ else {
62
+ const yCopy = [...y];
63
+ for (const itemX of x) {
64
+ let found = false;
65
+ for (let index = 0; index < yCopy.length; index++) {
66
+ if (compare(itemX, yCopy[index])) {
67
+ yCopy.splice(index, 1);
68
+ found = true;
69
+ break;
70
+ }
71
+ }
72
+ if (!found) {
73
+ return false;
74
+ }
75
+ }
76
+ return yCopy.length === 0;
77
+ }
78
+ return true;
79
+ }
80
+ if (x instanceof Set && y instanceof Set) {
81
+ if (x.size !== y.size) {
82
+ return false;
83
+ }
84
+ for (const item of x) {
85
+ let found = false;
86
+ for (const otherItem of y) {
87
+ if (compare(item, otherItem)) {
88
+ found = true;
89
+ break;
90
+ }
91
+ }
92
+ if (!found) {
93
+ return false;
94
+ }
95
+ }
96
+ return true;
97
+ }
98
+ if (x instanceof Map && y instanceof Map) {
99
+ if (x.size !== y.size) {
100
+ return false;
101
+ }
102
+ for (const [key, value] of x) {
103
+ let found = false;
104
+ for (const [otherKey, otherValue] of y) {
105
+ if (compare(key, otherKey) && compare(value, otherValue)) {
106
+ found = true;
107
+ break;
108
+ }
109
+ }
110
+ if (!found) {
111
+ return false;
112
+ }
113
+ }
114
+ return true;
115
+ }
116
+ if (ArrayBuffer.isView(x) && ArrayBuffer.isView(y)) {
117
+ const xArray = x;
118
+ const yArray = y;
119
+ if (xArray.byteLength !== yArray.byteLength) {
120
+ return false;
121
+ }
122
+ for (let index = 0; index < xArray.byteLength; index++) {
123
+ if (xArray[index] !== yArray[index]) {
124
+ return false;
125
+ }
126
+ }
127
+ return true;
128
+ }
129
+ const keysX = Object.keys(x);
130
+ const keysY = Object.keys(y);
131
+ if (keysX.length !== keysY.length) {
132
+ return false;
133
+ }
134
+ for (const key of keysX) {
135
+ if (!(key in y)) {
136
+ return false;
137
+ }
138
+ }
139
+ for (const key of keysX) {
140
+ if (!compare(x[key], y[key])) {
141
+ return false;
142
+ }
143
+ }
144
+ return true;
145
+ }
146
+ return compare(a, b);
147
+ }
148
+ //# sourceMappingURL=isDeepEqual.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isDeepEqual.js","sourceRoot":"","sources":["../../src/Validate/isDeepEqual.ts"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,WAAW,CACzB,CAAU,EACV,CAAU,EACV,UAA8B,EAAE;IAEhC,MAAM,EAAE,WAAW,GAAG,IAAI,EAAE,GAAG,OAAO,CAAC;IACvC,MAAM,OAAO,GAAG,IAAI,OAAO,EAAU,CAAC;IAEtC,SAAS,OAAO,CAAC,CAAU,EAAE,CAAU;QACrC,IAAI,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;YACpB,OAAO,IAAI,CAAC;QACd,CAAC;QAED,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;YAC3B,OAAO,KAAK,CAAC;QACf,CAAC;QAED,IAAI,OAAO,CAAC,KAAK,OAAO,CAAC,EAAE,CAAC;YAC1B,OAAO,KAAK,CAAC;QACf,CAAC;QAED,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE,CAAC;YACnD,OAAO,KAAK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AC,CAAC;QAE7B,IAAI,KAAK,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM,EAAE,CAAC;YAClC,OAAO,KAAK,CAAC;QACf,CAAC;QAED,KAAK,MAAM,GAAG,IAAI,KAAK,EAAE,CAAC;YACxB,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC;gBAChB,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC;QAED,KAAK,MAAM,GAAG,IAAI,KAAK,EAAE,CAAC;YACxB,IACE,CAAC,OAAO,CACL,CAA6B,CAAC,GAAG,CAAC,EAClC,CAA6B,CAAC,GAAG,CAAC,CACpC,EACD,CAAC;gBACD,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACvB,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Decodes a Base32 string to Uint8Array
3
+ * @param {string} input - Base32 encoded string
4
+ * @returns {Uint8Array} Decoded bytes
5
+ * @example decodeBase32("JBSWY3DP"); // Uint8Array for "Hello"
6
+ */
7
+ export declare const decodeBase32: (input: string) => Uint8Array;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.decodeBase32 = void 0;
7
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
8
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
9
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
10
+ /**
11
+ * Decodes a Base32 string to Uint8Array
12
+ * @param {string} input - Base32 encoded string
13
+ * @returns {Uint8Array} Decoded bytes
14
+ * @example decodeBase32("JBSWY3DP"); // Uint8Array for "Hello"
15
+ */
16
+ var decodeBase32 = exports.decodeBase32 = function decodeBase32(input) {
17
+ var alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
18
+ var cleanedInput = input.replaceAll("=", "");
19
+ var result = [];
20
+ var buffer = 0;
21
+ var bufferLength = 0;
22
+ var _iterator = _createForOfIteratorHelper(cleanedInput),
23
+ _step;
24
+ try {
25
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
26
+ var _char = _step.value;
27
+ var value = alphabet.indexOf(_char);
28
+ if (value === -1) {
29
+ throw new Error("Invalid base32 character: ".concat(_char));
30
+ }
31
+ buffer = buffer << 5 | value;
32
+ bufferLength += 5;
33
+ if (bufferLength >= 8) {
34
+ bufferLength -= 8;
35
+ result.push(buffer >> bufferLength & 0xff);
36
+ }
37
+ }
38
+ } catch (err) {
39
+ _iterator.e(err);
40
+ } finally {
41
+ _iterator.f();
42
+ }
43
+ return new Uint8Array(result);
44
+ };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Decodes a Base32 string to a UTF-8 string
3
+ * @param {string} input - Base32 encoded string
4
+ * @returns {string} Decoded string
5
+ * @example decodeBase32ToString("JBSWY3DP"); // "Hello"
6
+ */
7
+ export declare const decodeBase32ToString: (input: string) => string;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.decodeBase32ToString = void 0;
7
+ var _decodeBase = require("./decodeBase32");
8
+ /**
9
+ * Decodes a Base32 string to a UTF-8 string
10
+ * @param {string} input - Base32 encoded string
11
+ * @returns {string} Decoded string
12
+ * @example decodeBase32ToString("JBSWY3DP"); // "Hello"
13
+ */
14
+ var decodeBase32ToString = exports.decodeBase32ToString = function decodeBase32ToString(input) {
15
+ return new TextDecoder().decode((0, _decodeBase.decodeBase32)(input));
16
+ };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Decodes a Base58 string to Uint8Array
3
+ * @param {string} input - Base58 encoded string
4
+ * @returns {Uint8Array} Decoded bytes
5
+ * @example decodeBase58("9Ajdvzr"); // Uint8Array for "Hello"
6
+ */
7
+ export declare const decodeBase58: (input: string) => Uint8Array;
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.decodeBase58 = void 0;
7
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
8
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
9
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
10
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
11
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
12
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
13
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
14
+ /**
15
+ * Decodes a Base58 string to Uint8Array
16
+ * @param {string} input - Base58 encoded string
17
+ * @returns {Uint8Array} Decoded bytes
18
+ * @example decodeBase58("9Ajdvzr"); // Uint8Array for "Hello"
19
+ */
20
+ var decodeBase58 = exports.decodeBase58 = function decodeBase58(input) {
21
+ var alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
22
+ var bigNumber = BigInt(0);
23
+ var _iterator = _createForOfIteratorHelper(input),
24
+ _step;
25
+ try {
26
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
27
+ var _char = _step.value;
28
+ var value = alphabet.indexOf(_char);
29
+ if (value === -1) {
30
+ throw new Error("Invalid base58 character: ".concat(_char));
31
+ }
32
+ bigNumber = bigNumber * BigInt(58) + BigInt(value);
33
+ }
34
+ } catch (err) {
35
+ _iterator.e(err);
36
+ } finally {
37
+ _iterator.f();
38
+ }
39
+ var bytes = [];
40
+ while (bigNumber > 0) {
41
+ bytes.unshift(Number(bigNumber % BigInt(256)));
42
+ bigNumber /= BigInt(256);
43
+ }
44
+ var leadingOnes = 0;
45
+ var _iterator2 = _createForOfIteratorHelper(input),
46
+ _step2;
47
+ try {
48
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
49
+ var _char2 = _step2.value;
50
+ if (_char2 !== "1") {
51
+ break;
52
+ }
53
+ leadingOnes++;
54
+ }
55
+ } catch (err) {
56
+ _iterator2.e(err);
57
+ } finally {
58
+ _iterator2.f();
59
+ }
60
+ return new Uint8Array([].concat(_toConsumableArray(Array.from({
61
+ length: leadingOnes
62
+ }).fill(0)), bytes));
63
+ };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Decodes a Base58 string to a UTF-8 string
3
+ * @param {string} input - Base58 encoded string
4
+ * @returns {string} Decoded string
5
+ * @example decodeBase58ToString("9Ajdvzr"); // "Hello"
6
+ */
7
+ export declare const decodeBase58ToString: (input: string) => string;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.decodeBase58ToString = void 0;
7
+ var _decodeBase = require("./decodeBase58");
8
+ /**
9
+ * Decodes a Base58 string to a UTF-8 string
10
+ * @param {string} input - Base58 encoded string
11
+ * @returns {string} Decoded string
12
+ * @example decodeBase58ToString("9Ajdvzr"); // "Hello"
13
+ */
14
+ var decodeBase58ToString = exports.decodeBase58ToString = function decodeBase58ToString(input) {
15
+ return new TextDecoder().decode((0, _decodeBase.decodeBase58)(input));
16
+ };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Encodes a string or Uint8Array to Base32 format
3
+ * @param {string | Uint8Array} input - The input to encode
4
+ * @returns {string} Base32 encoded string
5
+ * @example encodeBase32("Hello"); // "JBSWY3DP"
6
+ */
7
+ export declare const encodeBase32: (input: string | Uint8Array) => string;
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.encodeBase32 = void 0;
7
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
8
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
9
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
10
+ /**
11
+ * Encodes a string or Uint8Array to Base32 format
12
+ * @param {string | Uint8Array} input - The input to encode
13
+ * @returns {string} Base32 encoded string
14
+ * @example encodeBase32("Hello"); // "JBSWY3DP"
15
+ */
16
+ var encodeBase32 = exports.encodeBase32 = function encodeBase32(input) {
17
+ var alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
18
+ var bytes = typeof input === "string" ? new TextEncoder().encode(input) : input;
19
+ var result = "";
20
+ var buffer = 0;
21
+ var bufferLength = 0;
22
+ var _iterator = _createForOfIteratorHelper(bytes),
23
+ _step;
24
+ try {
25
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
26
+ var _byte = _step.value;
27
+ buffer = buffer << 8 | _byte;
28
+ bufferLength += 8;
29
+ while (bufferLength >= 5) {
30
+ bufferLength -= 5;
31
+ result += alphabet[buffer >> bufferLength & 0x1f];
32
+ }
33
+ }
34
+ } catch (err) {
35
+ _iterator.e(err);
36
+ } finally {
37
+ _iterator.f();
38
+ }
39
+ if (bufferLength > 0) {
40
+ result += alphabet[buffer << 5 - bufferLength & 0x1f];
41
+ }
42
+ var paddingLength = (8 - result.length % 8) % 8;
43
+ result += "=".repeat(paddingLength);
44
+ return result;
45
+ };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Encodes a string or Uint8Array to Base58 format
3
+ * @param {string | Uint8Array} input - The input to encode
4
+ * @returns {string} Base58 encoded string
5
+ * @example encodeBase58("Hello"); // "9Ajdvzr"
6
+ */
7
+ export declare const encodeBase58: (input: string | Uint8Array) => string;
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.encodeBase58 = void 0;
7
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
8
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
9
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
10
+ /**
11
+ * Encodes a string or Uint8Array to Base58 format
12
+ * @param {string | Uint8Array} input - The input to encode
13
+ * @returns {string} Base58 encoded string
14
+ * @example encodeBase58("Hello"); // "9Ajdvzr"
15
+ */
16
+ var encodeBase58 = exports.encodeBase58 = function encodeBase58(input) {
17
+ var alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
18
+ var bytes = typeof input === "string" ? new TextEncoder().encode(input) : input;
19
+ var encoded = "";
20
+ var bigNumber = BigInt(0);
21
+ var _iterator = _createForOfIteratorHelper(bytes),
22
+ _step;
23
+ try {
24
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
25
+ var _byte = _step.value;
26
+ bigNumber = bigNumber * BigInt(256) + BigInt(_byte);
27
+ }
28
+ } catch (err) {
29
+ _iterator.e(err);
30
+ } finally {
31
+ _iterator.f();
32
+ }
33
+ while (bigNumber > 0) {
34
+ var remainder = Number(bigNumber % BigInt(58));
35
+ encoded = alphabet[remainder] + encoded;
36
+ bigNumber /= BigInt(58);
37
+ }
38
+ var leadingZeros = 0;
39
+ var _iterator2 = _createForOfIteratorHelper(bytes),
40
+ _step2;
41
+ try {
42
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
43
+ var _byte2 = _step2.value;
44
+ if (_byte2 !== 0) {
45
+ break;
46
+ }
47
+ leadingZeros++;
48
+ }
49
+ } catch (err) {
50
+ _iterator2.e(err);
51
+ } finally {
52
+ _iterator2.f();
53
+ }
54
+ return "1".repeat(leadingZeros) + encoded;
55
+ };