@art-suite/art-core-ts-compare 0.0.1 → 0.0.2

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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/compare.ts","../src/equality.ts"],"sourcesContent":["export * from './compare'\nexport * from './equality'","import { isArray, isPlainObject, isFunction } from '@art-suite/art-core-ts-types'\n\nexport interface CustomComparableInterface {\n\n /**\n * Compares `this` with `b`\n * @param b - The value to compare `this` with\n * @returns A number greater than zero if `this` is greater than `b`, less than zero if `this` is less than `b`, and zero if `this` is equal to `b`\n */\n compare(b: any): number\n}\n\nexport interface CustomEqualityInterface {\n /**\n * Checks if `this` equals `b`\n * @param b - The value to compare `this` with\n * @returns true if equal, false otherwise\n */\n eq(b: any): boolean\n}\n\nexport interface CustomInequalityInterface extends CustomEqualityInterface {\n /**\n * Checks if `this` is not equal to `b`\n * @param b - The value to compare `this` with\n * @returns true if not equal, false otherwise\n */\n lt(b: any): boolean\n gt(b: any): boolean\n lte(b: any): boolean\n gte(b: any): boolean\n}\n\nconst compareArrays = (a: any[], b: any[]): number => {\n const minLength = Math.min(a.length, b.length)\n\n for (let i = 0; i < minLength; i++) {\n const result = compare(a[i], b[i])\n if (result !== 0) return result\n }\n\n return a.length - b.length\n}\n\nconst comparePlainObjects = (a: Record<string, any>, b: Record<string, any>): number => {\n // Create a merged list of all unique keys and sort it\n const allKeys = [...new Set([...Object.keys(a), ...Object.keys(b)])].sort()\n\n // Iterate through the sorted keys to find the first non-zero comparison result\n for (const key of allKeys) {\n const aHas = key in a\n const bHas = key in b\n if (!aHas && bHas) return -1 // a is missing the key, so a is less\n if (aHas && !bHas) return 1 // b is missing the key, so b is less\n // Both have the key, compare their values\n const result = compare(a[key], b[key])\n if (result !== 0) return result\n }\n\n return 0 // All keys and values are equal\n}\n\nconst compareCustomComparableHelper = (a: any, b: any): number => {\n // Only check for custom methods if a is not null/undefined and is an object\n if (a !== null && a !== undefined && typeof a === 'object') {\n // Check if left operand supports any of the custom methods (highest priority)\n if (isFunction(a.compare)) return a.compare(b);\n if (isFunction(a.eq) && a?.eq(b)) return 0;\n if (isFunction(a.lt) && a?.lt(b)) return -1;\n if (isFunction(a.gt) && a?.gt(b)) return 1;\n if (isFunction(a.lte) && a?.lte(b)) return -1;\n if (isFunction(a.gte) && a?.gte(b)) return 1;\n }\n return NaN\n}\n\nconst compareCustomComparable = (a: any, b: any): number => {\n const customResult = compareCustomComparableHelper(a, b)\n if (!Number.isNaN(customResult)) return customResult\n return -compareCustomComparableHelper(b, a)\n}\n\nconst comparePrimitives = (a: any, b: any): number => {\n // Handle null\n if (a === null && b === null) return 0\n if (a === null) return -1\n if (b === null) return 1\n\n // Handle undefined\n if (a === undefined && b === undefined) return 0\n if (a === undefined) return 1\n if (b === undefined) return -1\n\n // Handle NaN\n if (Number.isNaN(a) && Number.isNaN(b)) return 0\n if (Number.isNaN(a)) return -1\n if (Number.isNaN(b)) return 1\n\n // Handle numbers - use subtraction for efficiency\n if (typeof a === 'number' && typeof b === 'number') {\n return a - b\n }\n\n // Handle strings - use localeCompare for proper string comparison\n if (typeof a === 'string' && typeof b === 'string') {\n return a.localeCompare(b)\n }\n\n // Handle booleans - convert to numbers for comparison\n if (typeof a === 'boolean' && typeof b === 'boolean') {\n return Number(a) - Number(b)\n }\n\n // Return NaN for different types or incompatible comparisons\n if (typeof a !== typeof b) return NaN\n\n // For same types that aren't numbers, strings, or booleans, return NaN\n return NaN\n}\n\nexport const compare = (a: any, b: any): number => {\n // Handle custom comparables first\n const customResult = compareCustomComparable(a, b)\n if (!Number.isNaN(customResult)) return customResult\n\n // Handle arrays\n if (isArray(a) && isArray(b)) {\n return compareArrays(a, b)\n }\n\n // Handle plain objects\n if (isPlainObject(a) && isPlainObject(b)) {\n return comparePlainObjects(a, b)\n }\n\n // Handle primitives\n return comparePrimitives(a, b)\n}","import { compare } from './compare'\n\nexport const eq = (a: any, b: any): boolean => compare(a, b) === 0;\nexport const neq = (a: any, b: any): boolean => compare(a, b) !== 0;\nexport const lt = (a: any, b: any): boolean => compare(a, b) < 0;\nexport const gt = (a: any, b: any): boolean => compare(a, b) > 0;\nexport const lte = (a: any, b: any): boolean => compare(a, b) <= 0;\nexport const gte = (a: any, b: any): boolean => compare(a, b) >= 0;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,+BAAmD;AAiCnD,IAAM,gBAAgB,CAAC,GAAU,MAAqB;AACpD,QAAM,YAAY,KAAK,IAAI,EAAE,QAAQ,EAAE,MAAM;AAE7C,WAAS,IAAI,GAAG,IAAI,WAAW,KAAK;AAClC,UAAM,SAAS,QAAQ,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC;AACjC,QAAI,WAAW,EAAG,QAAO;AAAA,EAC3B;AAEA,SAAO,EAAE,SAAS,EAAE;AACtB;AAEA,IAAM,sBAAsB,CAAC,GAAwB,MAAmC;AAEtF,QAAM,UAAU,CAAC,GAAG,oBAAI,IAAI,CAAC,GAAG,OAAO,KAAK,CAAC,GAAG,GAAG,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK;AAG1E,aAAW,OAAO,SAAS;AACzB,UAAM,OAAO,OAAO;AACpB,UAAM,OAAO,OAAO;AACpB,QAAI,CAAC,QAAQ,KAAM,QAAO;AAC1B,QAAI,QAAQ,CAAC,KAAM,QAAO;AAE1B,UAAM,SAAS,QAAQ,EAAE,GAAG,GAAG,EAAE,GAAG,CAAC;AACrC,QAAI,WAAW,EAAG,QAAO;AAAA,EAC3B;AAEA,SAAO;AACT;AAEA,IAAM,gCAAgC,CAAC,GAAQ,MAAmB;AAEhE,MAAI,MAAM,QAAQ,MAAM,UAAa,OAAO,MAAM,UAAU;AAE1D,YAAI,qCAAW,EAAE,OAAO,EAAG,QAAO,EAAE,QAAQ,CAAC;AAC7C,YAAI,qCAAW,EAA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,QAAO;AAGlC,SAAO;AACT;AAEO,IAAM,UAAU,CAAC,GAAQ,MAAmB;AAEjD,QAAM,eAAe,wBAAwB,GAAG,CAAC;AACjD,MAAI,CAAC,OAAO,MAAM,YAAY,EAAG,QAAO;AAGxC,UAAI,kCAAQ,CAAC,SAAK,kCAAQ,CAAC,GAAG;AAC5B,WAAO,cAAc,GAAG,CAAC;AAAA,EAC3B;AAGA,UAAI,wCAAc,CAAC,SAAK,wCAAc,CAAC,GAAG;AACxC,WAAO,oBAAoB,GAAG,CAAC;AAAA,EACjC;AAGA,SAAO,kBAAkB,GAAG,CAAC;AAC/B;;;ACvIO,IAAM,KAAK,CAAC,GAAQ,MAAoB,QAAQ,GAAG,CAAC,MAAM;AAC1D,IAAM,MAAM,CAAC,GAAQ,MAAoB,QAAQ,GAAG,CAAC,MAAM;AAC3D,IAAM,KAAK,CAAC,GAAQ,MAAoB,QAAQ,GAAG,CAAC,IAAI;AACxD,IAAM,KAAK,CAAC,GAAQ,MAAoB,QAAQ,GAAG,CAAC,IAAI;AACxD,IAAM,MAAM,CAAC,GAAQ,MAAoB,QAAQ,GAAG,CAAC,KAAK;AAC1D,IAAM,MAAM,CAAC,GAAQ,MAAoB,QAAQ,GAAG,CAAC,KAAK;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts","../src/compare.ts","../src/equality.ts"],"sourcesContent":["export * from './compare'\nexport * from './equality'","import { isArray, isPlainObject, isFunction } from '@art-suite/art-core-ts-types'\n\nexport interface CustomComparableInterface {\n\n /**\n * Compares `this` with `b`\n * @param b - The value to compare `this` with\n * @returns A number greater than zero if `this` is greater than `b`, less than zero if `this` is less than `b`, and zero if `this` is equal to `b`\n */\n compare(b: any): number\n}\n\nexport interface CustomEqualityInterface {\n /**\n * Checks if `this` equals `b`\n * @param b - The value to compare `this` with\n * @returns true if equal, false otherwise\n */\n eq(b: any): boolean\n}\n\nexport interface CustomInequalityInterface extends CustomEqualityInterface {\n /**\n * Checks if `this` is not equal to `b`\n * @param b - The value to compare `this` with\n * @returns true if not equal, false otherwise\n */\n lt(b: any): boolean\n gt(b: any): boolean\n lte(b: any): boolean\n gte(b: any): boolean\n}\n\nconst compareArrays = (a: any[], b: any[]): number => {\n const minLength = Math.min(a.length, b.length)\n\n for (let i = 0; i < minLength; i++) {\n const result = compare(a[i], b[i])\n if (result !== 0) return result\n }\n\n return a.length - b.length\n}\n\nconst comparePlainObjects = (a: Record<string, any>, b: Record<string, any>): number => {\n // Create a merged list of all unique keys and sort it\n const allKeys = [...new Set([...Object.keys(a), ...Object.keys(b)])].sort()\n\n // Iterate through the sorted keys to find the first non-zero comparison result\n for (const key of allKeys) {\n const aHas = key in a\n const bHas = key in b\n if (!aHas && bHas) return -1 // a is missing the key, so a is less\n if (aHas && !bHas) return 1 // b is missing the key, so b is less\n // Both have the key, compare their values\n const result = compare(a[key], b[key])\n if (result !== 0) return result\n }\n\n return 0 // All keys and values are equal\n}\n\nconst compareCustomComparableHelper = (a: any, b: any): number => {\n // Only check for custom methods if a is not null/undefined and is an object\n if (a !== null && a !== undefined && typeof a === 'object') {\n // Check if left operand supports any of the custom methods (highest priority)\n if (isFunction(a.compare)) return a.compare(b);\n if (isFunction(a.eq) && a?.eq(b)) return 0;\n if (isFunction(a.lt) && a?.lt(b)) return -1;\n if (isFunction(a.gt) && a?.gt(b)) return 1;\n if (isFunction(a.lte) && a?.lte(b)) return -1;\n if (isFunction(a.gte) && a?.gte(b)) return 1;\n }\n return NaN\n}\n\nconst compareCustomComparable = (a: any, b: any): number => {\n const customResult = compareCustomComparableHelper(a, b)\n if (!Number.isNaN(customResult)) return customResult\n return -compareCustomComparableHelper(b, a)\n}\n\nconst comparePrimitives = (a: any, b: any): number => {\n // Handle null\n if (a === null && b === null) return 0\n if (a === null) return -1\n if (b === null) return 1\n\n // Handle undefined\n if (a === undefined && b === undefined) return 0\n if (a === undefined) return 1\n if (b === undefined) return -1\n\n // Handle NaN\n if (Number.isNaN(a) && Number.isNaN(b)) return 0\n if (Number.isNaN(a)) return -1\n if (Number.isNaN(b)) return 1\n\n // Handle numbers - use subtraction for efficiency\n if (typeof a === 'number' && typeof b === 'number') {\n return a - b\n }\n\n // Handle strings - use localeCompare for proper string comparison\n if (typeof a === 'string' && typeof b === 'string') {\n return a.localeCompare(b)\n }\n\n // Handle booleans - convert to numbers for comparison\n if (typeof a === 'boolean' && typeof b === 'boolean') {\n return Number(a) - Number(b)\n }\n\n // Return NaN for different types or incompatible comparisons\n if (typeof a !== typeof b) return NaN\n\n // For same types that aren't numbers, strings, or booleans, return NaN\n return NaN\n}\n\n/**\n * deep structural comparison\n *\n * @param a - The first value to compare\n * @param b - The second value to compare\n * @returns A number indicating the comparison result:\n * - **< 0**: `a` is less than `b`\n * - **== 0**: `a` is equal to `b` (deep structural equality)\n * - **> 0**: `a` is greater than `b`\n * - **NaN**: Values cannot be compared (incompatible types or custom comparison failed)\n *\n * For more details on comparison behavior, see the art-core-ts-compare README.\n */\nexport const compare = (a: any, b: any): number => {\n // Handle custom comparables first\n const customResult = compareCustomComparable(a, b)\n if (!Number.isNaN(customResult)) return customResult\n\n // Handle arrays\n if (isArray(a) && isArray(b)) {\n return compareArrays(a, b)\n }\n\n // Handle plain objects\n if (isPlainObject(a) && isPlainObject(b)) {\n return comparePlainObjects(a, b)\n }\n\n // Handle primitives\n return comparePrimitives(a, b)\n}","import { compare } from './compare'\n\n/**\n * deep structural == test\n *\n * @param a - The first value to compare\n * @param b - The second value to compare\n * @returns `true` if the values are deeply equal (compare returns 0), `false` otherwise\n *\n * For more details on comparison behavior, see the art-core-ts-compare README.\n */\nexport const eq = (a: any, b: any): boolean => compare(a, b) === 0;\n\n/**\n * deep structural != test\n *\n * @param a - The first value to compare\n * @param b - The second value to compare\n * @returns `true` if the values are not deeply equal (compare returns non-zero), `false` otherwise\n *\n * For more details on comparison behavior, see the art-core-ts-compare README.\n */\nexport const neq = (a: any, b: any): boolean => compare(a, b) !== 0;\n\n/**\n * deep structural < test\n *\n * @param a - The first value to compare\n * @param b - The second value to compare\n * @returns `true` if `a` is less than `b` (compare returns negative), `false` otherwise\n *\n * For more details on comparison behavior, see the art-core-ts-compare README.\n */\nexport const lt = (a: any, b: any): boolean => compare(a, b) < 0;\n\n/**\n * deep structural > test\n *\n * @param a - The first value to compare\n * @param b - The second value to compare\n * @returns `true` if `a` is greater than `b` (compare returns positive), `false` otherwise\n *\n * For more details on comparison behavior, see the art-core-ts-compare README.\n */\nexport const gt = (a: any, b: any): boolean => compare(a, b) > 0;\n\n/**\n * deep structural <= test\n *\n * @param a - The first value to compare\n * @param b - The second value to compare\n * @returns `true` if `a` is less than or equal to `b` (compare returns negative or zero), `false` otherwise\n *\n * For more details on comparison behavior, see the art-core-ts-compare README.\n */\nexport const lte = (a: any, b: any): boolean => compare(a, b) <= 0;\n\n/**\n * deep structural >= test\n *\n * @param a - The first value to compare\n * @param b - The second value to compare\n * @returns `true` if `a` is greater than or equal to `b` (compare returns positive or zero), `false` otherwise\n *\n * For more details on comparison behavior, see the art-core-ts-compare README.\n */\nexport const gte = (a: any, b: any): boolean => compare(a, b) >= 0;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,+BAAmD;AAiCnD,IAAM,gBAAgB,CAAC,GAAU,MAAqB;AACpD,QAAM,YAAY,KAAK,IAAI,EAAE,QAAQ,EAAE,MAAM;AAE7C,WAAS,IAAI,GAAG,IAAI,WAAW,KAAK;AAClC,UAAM,SAAS,QAAQ,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC;AACjC,QAAI,WAAW,EAAG,QAAO;AAAA,EAC3B;AAEA,SAAO,EAAE,SAAS,EAAE;AACtB;AAEA,IAAM,sBAAsB,CAAC,GAAwB,MAAmC;AAEtF,QAAM,UAAU,CAAC,GAAG,oBAAI,IAAI,CAAC,GAAG,OAAO,KAAK,CAAC,GAAG,GAAG,OAAO,KAAK,CAAC,CAAC,CAAC,CA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GAAG,CAAC,KAAK;","names":[]}
package/dist/index.d.cts CHANGED
@@ -25,13 +25,80 @@ interface CustomInequalityInterface extends CustomEqualityInterface {
25
25
  lte(b: any): boolean;
26
26
  gte(b: any): boolean;
27
27
  }
28
+ /**
29
+ * deep structural comparison
30
+ *
31
+ * @param a - The first value to compare
32
+ * @param b - The second value to compare
33
+ * @returns A number indicating the comparison result:
34
+ * - **< 0**: `a` is less than `b`
35
+ * - **== 0**: `a` is equal to `b` (deep structural equality)
36
+ * - **> 0**: `a` is greater than `b`
37
+ * - **NaN**: Values cannot be compared (incompatible types or custom comparison failed)
38
+ *
39
+ * For more details on comparison behavior, see the art-core-ts-compare README.
40
+ */
28
41
  declare const compare: (a: any, b: any) => number;
29
42
 
43
+ /**
44
+ * deep structural == test
45
+ *
46
+ * @param a - The first value to compare
47
+ * @param b - The second value to compare
48
+ * @returns `true` if the values are deeply equal (compare returns 0), `false` otherwise
49
+ *
50
+ * For more details on comparison behavior, see the art-core-ts-compare README.
51
+ */
30
52
  declare const eq: (a: any, b: any) => boolean;
53
+ /**
54
+ * deep structural != test
55
+ *
56
+ * @param a - The first value to compare
57
+ * @param b - The second value to compare
58
+ * @returns `true` if the values are not deeply equal (compare returns non-zero), `false` otherwise
59
+ *
60
+ * For more details on comparison behavior, see the art-core-ts-compare README.
61
+ */
31
62
  declare const neq: (a: any, b: any) => boolean;
63
+ /**
64
+ * deep structural < test
65
+ *
66
+ * @param a - The first value to compare
67
+ * @param b - The second value to compare
68
+ * @returns `true` if `a` is less than `b` (compare returns negative), `false` otherwise
69
+ *
70
+ * For more details on comparison behavior, see the art-core-ts-compare README.
71
+ */
32
72
  declare const lt: (a: any, b: any) => boolean;
73
+ /**
74
+ * deep structural > test
75
+ *
76
+ * @param a - The first value to compare
77
+ * @param b - The second value to compare
78
+ * @returns `true` if `a` is greater than `b` (compare returns positive), `false` otherwise
79
+ *
80
+ * For more details on comparison behavior, see the art-core-ts-compare README.
81
+ */
33
82
  declare const gt: (a: any, b: any) => boolean;
83
+ /**
84
+ * deep structural <= test
85
+ *
86
+ * @param a - The first value to compare
87
+ * @param b - The second value to compare
88
+ * @returns `true` if `a` is less than or equal to `b` (compare returns negative or zero), `false` otherwise
89
+ *
90
+ * For more details on comparison behavior, see the art-core-ts-compare README.
91
+ */
34
92
  declare const lte: (a: any, b: any) => boolean;
93
+ /**
94
+ * deep structural >= test
95
+ *
96
+ * @param a - The first value to compare
97
+ * @param b - The second value to compare
98
+ * @returns `true` if `a` is greater than or equal to `b` (compare returns positive or zero), `false` otherwise
99
+ *
100
+ * For more details on comparison behavior, see the art-core-ts-compare README.
101
+ */
35
102
  declare const gte: (a: any, b: any) => boolean;
36
103
 
37
104
  export { type CustomComparableInterface, type CustomEqualityInterface, type CustomInequalityInterface, compare, eq, gt, gte, lt, lte, neq };
package/dist/index.d.ts CHANGED
@@ -25,13 +25,80 @@ interface CustomInequalityInterface extends CustomEqualityInterface {
25
25
  lte(b: any): boolean;
26
26
  gte(b: any): boolean;
27
27
  }
28
+ /**
29
+ * deep structural comparison
30
+ *
31
+ * @param a - The first value to compare
32
+ * @param b - The second value to compare
33
+ * @returns A number indicating the comparison result:
34
+ * - **< 0**: `a` is less than `b`
35
+ * - **== 0**: `a` is equal to `b` (deep structural equality)
36
+ * - **> 0**: `a` is greater than `b`
37
+ * - **NaN**: Values cannot be compared (incompatible types or custom comparison failed)
38
+ *
39
+ * For more details on comparison behavior, see the art-core-ts-compare README.
40
+ */
28
41
  declare const compare: (a: any, b: any) => number;
29
42
 
43
+ /**
44
+ * deep structural == test
45
+ *
46
+ * @param a - The first value to compare
47
+ * @param b - The second value to compare
48
+ * @returns `true` if the values are deeply equal (compare returns 0), `false` otherwise
49
+ *
50
+ * For more details on comparison behavior, see the art-core-ts-compare README.
51
+ */
30
52
  declare const eq: (a: any, b: any) => boolean;
53
+ /**
54
+ * deep structural != test
55
+ *
56
+ * @param a - The first value to compare
57
+ * @param b - The second value to compare
58
+ * @returns `true` if the values are not deeply equal (compare returns non-zero), `false` otherwise
59
+ *
60
+ * For more details on comparison behavior, see the art-core-ts-compare README.
61
+ */
31
62
  declare const neq: (a: any, b: any) => boolean;
63
+ /**
64
+ * deep structural < test
65
+ *
66
+ * @param a - The first value to compare
67
+ * @param b - The second value to compare
68
+ * @returns `true` if `a` is less than `b` (compare returns negative), `false` otherwise
69
+ *
70
+ * For more details on comparison behavior, see the art-core-ts-compare README.
71
+ */
32
72
  declare const lt: (a: any, b: any) => boolean;
73
+ /**
74
+ * deep structural > test
75
+ *
76
+ * @param a - The first value to compare
77
+ * @param b - The second value to compare
78
+ * @returns `true` if `a` is greater than `b` (compare returns positive), `false` otherwise
79
+ *
80
+ * For more details on comparison behavior, see the art-core-ts-compare README.
81
+ */
33
82
  declare const gt: (a: any, b: any) => boolean;
83
+ /**
84
+ * deep structural <= test
85
+ *
86
+ * @param a - The first value to compare
87
+ * @param b - The second value to compare
88
+ * @returns `true` if `a` is less than or equal to `b` (compare returns negative or zero), `false` otherwise
89
+ *
90
+ * For more details on comparison behavior, see the art-core-ts-compare README.
91
+ */
34
92
  declare const lte: (a: any, b: any) => boolean;
93
+ /**
94
+ * deep structural >= test
95
+ *
96
+ * @param a - The first value to compare
97
+ * @param b - The second value to compare
98
+ * @returns `true` if `a` is greater than or equal to `b` (compare returns positive or zero), `false` otherwise
99
+ *
100
+ * For more details on comparison behavior, see the art-core-ts-compare README.
101
+ */
35
102
  declare const gte: (a: any, b: any) => boolean;
36
103
 
37
104
  export { type CustomComparableInterface, type CustomEqualityInterface, type CustomInequalityInterface, compare, eq, gt, gte, lt, lte, neq };
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/compare.ts","../src/equality.ts"],"sourcesContent":["import { isArray, isPlainObject, isFunction } from '@art-suite/art-core-ts-types'\n\nexport interface CustomComparableInterface {\n\n /**\n * Compares `this` with `b`\n * @param b - The value to compare `this` with\n * @returns A number greater than zero if `this` is greater than `b`, less than zero if `this` is less than `b`, and zero if `this` is equal to `b`\n */\n compare(b: any): number\n}\n\nexport interface CustomEqualityInterface {\n /**\n * Checks if `this` equals `b`\n * @param b - The value to compare `this` with\n * @returns true if equal, false otherwise\n */\n eq(b: any): boolean\n}\n\nexport interface CustomInequalityInterface extends CustomEqualityInterface {\n /**\n * Checks if `this` is not equal to `b`\n * @param b - The value to compare `this` with\n * @returns true if not equal, false otherwise\n */\n lt(b: any): boolean\n gt(b: any): boolean\n lte(b: any): boolean\n gte(b: any): boolean\n}\n\nconst compareArrays = (a: any[], b: any[]): number => {\n const minLength = Math.min(a.length, b.length)\n\n for (let i = 0; i < minLength; i++) {\n const result = compare(a[i], b[i])\n if (result !== 0) return result\n }\n\n return a.length - b.length\n}\n\nconst comparePlainObjects = (a: Record<string, any>, b: Record<string, any>): number => {\n // Create a merged list of all unique keys and sort it\n const allKeys = [...new Set([...Object.keys(a), ...Object.keys(b)])].sort()\n\n // Iterate through the sorted keys to find the first non-zero comparison result\n for (const key of allKeys) {\n const aHas = key in a\n const bHas = key in b\n if (!aHas && bHas) return -1 // a is missing the key, so a is less\n if (aHas && !bHas) return 1 // b is missing the key, so b is less\n // Both have the key, compare their values\n const result = compare(a[key], b[key])\n if (result !== 0) return result\n }\n\n return 0 // All keys and values are equal\n}\n\nconst compareCustomComparableHelper = (a: any, b: any): number => {\n // Only check for custom methods if a is not null/undefined and is an object\n if (a !== null && a !== undefined && typeof a === 'object') {\n // Check if left operand supports any of the custom methods (highest priority)\n if (isFunction(a.compare)) return a.compare(b);\n if (isFunction(a.eq) && a?.eq(b)) return 0;\n if (isFunction(a.lt) && a?.lt(b)) return -1;\n if (isFunction(a.gt) && a?.gt(b)) return 1;\n if (isFunction(a.lte) && a?.lte(b)) return -1;\n if (isFunction(a.gte) && a?.gte(b)) return 1;\n }\n return NaN\n}\n\nconst compareCustomComparable = (a: any, b: any): number => {\n const customResult = compareCustomComparableHelper(a, b)\n if (!Number.isNaN(customResult)) return customResult\n return -compareCustomComparableHelper(b, a)\n}\n\nconst comparePrimitives = (a: any, b: any): number => {\n // Handle null\n if (a === null && b === null) return 0\n if (a === null) return -1\n if (b === null) return 1\n\n // Handle undefined\n if (a === undefined && b === undefined) return 0\n if (a === undefined) return 1\n if (b === undefined) return -1\n\n // Handle NaN\n if (Number.isNaN(a) && Number.isNaN(b)) return 0\n if (Number.isNaN(a)) return -1\n if (Number.isNaN(b)) return 1\n\n // Handle numbers - use subtraction for efficiency\n if (typeof a === 'number' && typeof b === 'number') {\n return a - b\n }\n\n // Handle strings - use localeCompare for proper string comparison\n if (typeof a === 'string' && typeof b === 'string') {\n return a.localeCompare(b)\n }\n\n // Handle booleans - convert to numbers for comparison\n if (typeof a === 'boolean' && typeof b === 'boolean') {\n return Number(a) - Number(b)\n }\n\n // Return NaN for different types or incompatible comparisons\n if (typeof a !== typeof b) return NaN\n\n // For same types that aren't numbers, strings, or booleans, return NaN\n return NaN\n}\n\nexport const compare = (a: any, b: any): number => {\n // Handle custom comparables first\n const customResult = compareCustomComparable(a, b)\n if (!Number.isNaN(customResult)) return customResult\n\n // Handle arrays\n if (isArray(a) && isArray(b)) {\n return compareArrays(a, b)\n }\n\n // Handle plain objects\n if (isPlainObject(a) && isPlainObject(b)) {\n return comparePlainObjects(a, b)\n }\n\n // Handle primitives\n return comparePrimitives(a, b)\n}","import { compare } from './compare'\n\nexport const eq = (a: any, b: any): boolean => compare(a, b) === 0;\nexport const neq = (a: any, b: any): boolean => compare(a, b) !== 0;\nexport const lt = (a: any, b: any): boolean => compare(a, b) < 0;\nexport const gt = (a: any, b: any): boolean => compare(a, b) > 0;\nexport const lte = (a: any, b: any): boolean => compare(a, b) <= 0;\nexport const gte = (a: any, b: any): boolean => compare(a, b) >= 0;\n"],"mappings":";AAAA,SAAS,SAAS,eAAe,kBAAkB;AAiCnD,IAAM,gBAAgB,CAAC,GAAU,MAAqB;AACpD,QAAM,YAAY,KAAK,IAAI,EAAE,QAAQ,EAAE,MAAM;AAE7C,WAAS,IAAI,GAAG,IAAI,WAA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AM,MAAM,CAAC,GAAQ,MAAoB,QAAQ,GAAG,CAAC,MAAM;AAC3D,IAAM,KAAK,CAAC,GAAQ,MAAoB,QAAQ,GAAG,CAAC,IAAI;AACxD,IAAM,KAAK,CAAC,GAAQ,MAAoB,QAAQ,GAAG,CAAC,IAAI;AACxD,IAAM,MAAM,CAAC,GAAQ,MAAoB,QAAQ,GAAG,CAAC,KAAK;AAC1D,IAAM,MAAM,CAAC,GAAQ,MAAoB,QAAQ,GAAG,CAAC,KAAK;","names":[]}
1
+ {"version":3,"sources":["../src/compare.ts","../src/equality.ts"],"sourcesContent":["import { isArray, isPlainObject, isFunction } from '@art-suite/art-core-ts-types'\n\nexport interface CustomComparableInterface {\n\n /**\n * Compares `this` with `b`\n * @param b - The value to compare `this` with\n * @returns A number greater than zero if `this` is greater than `b`, less than zero if `this` is less than `b`, and zero if `this` is equal to `b`\n */\n compare(b: any): number\n}\n\nexport interface CustomEqualityInterface {\n /**\n * Checks if `this` equals `b`\n * @param b - The value to compare `this` with\n * @returns true if equal, false otherwise\n */\n eq(b: any): boolean\n}\n\nexport interface CustomInequalityInterface extends CustomEqualityInterface {\n /**\n * Checks if `this` is not equal to `b`\n * @param b - The value to compare `this` with\n * @returns true if not equal, false otherwise\n */\n lt(b: any): boolean\n gt(b: any): boolean\n lte(b: any): boolean\n gte(b: any): boolean\n}\n\nconst compareArrays = (a: any[], b: any[]): number => {\n const minLength = Math.min(a.length, b.length)\n\n for (let i = 0; i < minLength; i++) {\n const result = compare(a[i], b[i])\n if (result !== 0) return result\n }\n\n return a.length - b.length\n}\n\nconst comparePlainObjects = (a: Record<string, any>, b: Record<string, any>): number => {\n // Create a merged list of all unique keys and sort it\n const allKeys = [...new Set([...Object.keys(a), ...Object.keys(b)])].sort()\n\n // Iterate through the sorted keys to find the first non-zero comparison result\n for (const key of allKeys) {\n const aHas = key in a\n const bHas = key in b\n if (!aHas && bHas) return -1 // a is missing the key, so a is less\n if (aHas && !bHas) return 1 // b is missing the key, so b is less\n // Both have the key, compare their values\n const result = compare(a[key], b[key])\n if (result !== 0) return result\n }\n\n return 0 // All keys and values are equal\n}\n\nconst compareCustomComparableHelper = (a: any, b: any): number => {\n // Only check for custom methods if a is not null/undefined and is an object\n if (a !== null && a !== undefined && typeof a === 'object') {\n // Check if left operand supports any of the custom methods (highest priority)\n if (isFunction(a.compare)) return a.compare(b);\n if (isFunction(a.eq) && a?.eq(b)) return 0;\n if (isFunction(a.lt) && a?.lt(b)) return -1;\n if (isFunction(a.gt) && a?.gt(b)) return 1;\n if (isFunction(a.lte) && a?.lte(b)) return -1;\n if (isFunction(a.gte) && a?.gte(b)) return 1;\n }\n return NaN\n}\n\nconst compareCustomComparable = (a: any, b: any): number => {\n const customResult = compareCustomComparableHelper(a, b)\n if (!Number.isNaN(customResult)) return customResult\n return -compareCustomComparableHelper(b, a)\n}\n\nconst comparePrimitives = (a: any, b: any): number => {\n // Handle null\n if (a === null && b === null) return 0\n if (a === null) return -1\n if (b === null) return 1\n\n // Handle undefined\n if (a === undefined && b === undefined) return 0\n if (a === undefined) return 1\n if (b === undefined) return -1\n\n // Handle NaN\n if (Number.isNaN(a) && Number.isNaN(b)) return 0\n if (Number.isNaN(a)) return -1\n if (Number.isNaN(b)) return 1\n\n // Handle numbers - use subtraction for efficiency\n if (typeof a === 'number' && typeof b === 'number') {\n return a - b\n }\n\n // Handle strings - use localeCompare for proper string comparison\n if (typeof a === 'string' && typeof b === 'string') {\n return a.localeCompare(b)\n }\n\n // Handle booleans - convert to numbers for comparison\n if (typeof a === 'boolean' && typeof b === 'boolean') {\n return Number(a) - Number(b)\n }\n\n // Return NaN for different types or incompatible comparisons\n if (typeof a !== typeof b) return NaN\n\n // For same types that aren't numbers, strings, or booleans, return NaN\n return NaN\n}\n\n/**\n * deep structural comparison\n *\n * @param a - The first value to compare\n * @param b - The second value to compare\n * @returns A number indicating the comparison result:\n * - **< 0**: `a` is less than `b`\n * - **== 0**: `a` is equal to `b` (deep structural equality)\n * - **> 0**: `a` is greater than `b`\n * - **NaN**: Values cannot be compared (incompatible types or custom comparison failed)\n *\n * For more details on comparison behavior, see the art-core-ts-compare README.\n */\nexport const compare = (a: any, b: any): number => {\n // Handle custom comparables first\n const customResult = compareCustomComparable(a, b)\n if (!Number.isNaN(customResult)) return customResult\n\n // Handle arrays\n if (isArray(a) && isArray(b)) {\n return compareArrays(a, b)\n }\n\n // Handle plain objects\n if (isPlainObject(a) && isPlainObject(b)) {\n return comparePlainObjects(a, b)\n }\n\n // Handle primitives\n return comparePrimitives(a, b)\n}","import { compare } from './compare'\n\n/**\n * deep structural == test\n *\n * @param a - The first value to compare\n * @param b - The second value to compare\n * @returns `true` if the values are deeply equal (compare returns 0), `false` otherwise\n *\n * For more details on comparison behavior, see the art-core-ts-compare README.\n */\nexport const eq = (a: any, b: any): boolean => compare(a, b) === 0;\n\n/**\n * deep structural != test\n *\n * @param a - The first value to compare\n * @param b - The second value to compare\n * @returns `true` if the values are not deeply equal (compare returns non-zero), `false` otherwise\n *\n * For more details on comparison behavior, see the art-core-ts-compare README.\n */\nexport const neq = (a: any, b: any): boolean => compare(a, b) !== 0;\n\n/**\n * deep structural < test\n *\n * @param a - The first value to compare\n * @param b - The second value to compare\n * @returns `true` if `a` is less than `b` (compare returns negative), `false` otherwise\n *\n * For more details on comparison behavior, see the art-core-ts-compare README.\n */\nexport const lt = (a: any, b: any): boolean => compare(a, b) < 0;\n\n/**\n * deep structural > test\n *\n * @param a - The first value to compare\n * @param b - The second value to compare\n * @returns `true` if `a` is greater than `b` (compare returns positive), `false` otherwise\n *\n * For more details on comparison behavior, see the art-core-ts-compare README.\n */\nexport const gt = (a: any, b: any): boolean => compare(a, b) > 0;\n\n/**\n * deep structural <= test\n *\n * @param a - The first value to compare\n * @param b - The second value to compare\n * @returns `true` if `a` is less than or equal to `b` (compare returns negative or zero), `false` otherwise\n *\n * For more details on comparison behavior, see the art-core-ts-compare README.\n */\nexport const lte = (a: any, b: any): boolean => compare(a, b) <= 0;\n\n/**\n * deep structural >= test\n *\n * @param a - The first value to compare\n * @param b - The second value to compare\n * @returns `true` if `a` is greater than or equal to `b` (compare returns positive or zero), `false` otherwise\n *\n * For more details on comparison behavior, see the art-core-ts-compare README.\n */\nexport const gte = (a: any, b: any): boolean => compare(a, b) >= 0;\n"],"mappings":";AAAA,SAAS,SAAS,eAAe,kBAAkB;AAiCnD,IAAM,gBAAgB,CAAC,GAAU,MAAqB;AACpD,QAAM,YAAY,KAAK,IAAI,EAAE,QAAQ,EAAE,MAAM;AAE7C,WAAS,IAAI,GAAG,IAAI,WAAW,KAAK;AAClC,UAAM,SAAS,QAAQ,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC;AACjC,QAAI,WAAW,EAAG,QAAO;AAAA,EAC3B;AAEA,SAAO,EAAE,SAAS,EAAE;AACtB;AAEA,IAAM,sBAAsB,CAAC,GAAwB,MAAmC;AAEtF,QAAM,UAAU,CAAC,GAAG,oBAAI,IAAI,CAAC,GAAG,OAAO,KAAK,CAAC,GAAG,GAAG,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK;AAG1E,aAAW,OAAO,SAAS;AACzB,UAAM,OAAO,OAAO;AACpB,UAAM,OAAO,OAAO;AACpB,QAAI,CAAC,QAAQ,KAAM,QAAO;AAC1B,QAAI,QAAQ,CAAC,KAAM,QAAO;AAE1B,UAAM,SAAS,QAAQ,EAAE,GAAG,GAAG,EAAE,GAAG,CAAC;AACrC,QAAI,WAAW,EAAG,QAAO;AAAA,EAC3B;AAEA,SAAO;AACT;AAEA,IAAM,gCAAgC,CAAC,GAAQ,MAAmB;AAEhE,MAAI,MAAM,QAAQ,MAAM,UAAa,OAAO,MAAM,UAAU;AAE1D,QAAI,WAAW,EAAE,OAAO,EAAG,QAAO,EAAE,QAAQ,CAAC;AAC7C,QAAI,WAAW,EAAE,EAAE,KAAK,GAAG,GAAG,CAAC,EAAG,QAAO;AACzC,QAAI,WAAW,EAAE,EAAE,KAAK,GAAG,GAAG,CAA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C;AACjD,MAAI,CAAC,OAAO,MAAM,YAAY,EAAG,QAAO;AAGxC,MAAI,QAAQ,CAAC,KAAK,QAAQ,CAAC,GAAG;AAC5B,WAAO,cAAc,GAAG,CAAC;AAAA,EAC3B;AAGA,MAAI,cAAc,CAAC,KAAK,cAAc,CAAC,GAAG;AACxC,WAAO,oBAAoB,GAAG,CAAC;AAAA,EACjC;AAGA,SAAO,kBAAkB,GAAG,CAAC;AAC/B;;;AC3IO,IAAM,KAAK,CAAC,GAAQ,MAAoB,QAAQ,GAAG,CAAC,MAAM;AAW1D,IAAM,MAAM,CAAC,GAAQ,MAAoB,QAAQ,GAAG,CAAC,MAAM;AAW3D,IAAM,KAAK,CAAC,GAAQ,MAAoB,QAAQ,GAAG,CAAC,IAAI;AAWxD,IAAM,KAAK,CAAC,GAAQ,MAAoB,QAAQ,GAAG,CAAC,IAAI;AAWxD,IAAM,MAAM,CAAC,GAAQ,MAAoB,QAAQ,GAAG,CAAC,KAAK;AAW1D,IAAM,MAAM,CAAC,GAAQ,MAAoB,QAAQ,GAAG,CAAC,KAAK;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@art-suite/art-core-ts-compare",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "A TypeScript comparison utility library",
5
5
  "keywords": [],
6
6
  "repository": {