MCPcopy Create free account
hub / github.com/mikro-orm/mikro-orm / compareArrays

Function compareArrays

packages/core/src/utils/Utils.ts:107–122  ·  view source on GitHub ↗
(a: any[] | string, b: any[] | string)

Source from the content-addressed store, hash-verified

105
106/** Compares two arrays element-by-element for deep equality. */
107export function compareArrays(a: any[] | string, b: any[] | string): boolean {
108 const length = a.length;
109
110 if (length !== b.length) {
111 return false;
112 }
113
114 for (let i = length; i-- !== 0; ) {
115 // eslint-disable-next-line @typescript-eslint/no-use-before-define
116 if (!equals(a[i], b[i])) {
117 return false;
118 }
119 }
120
121 return true;
122}
123
124/** Compares two boolean values, treating numeric 0/1 as false/true. */
125export function compareBooleans(a: unknown, b: unknown): boolean {

Callers 3

compareObjectsFunction · 0.85
equalsFunction · 0.85

Calls 1

equalsFunction · 0.85

Tested by

no test coverage detected