Returns a boolean of whether or not the first parameter is equal in value to the second. Accepts strings, objects or arrays. Optionally pass in a third parameter to enforce loose matching on casing, spaces and order.
export function isEqual<T extends string | any[] | Record<any, any>>(
a: T,
b: T
options: MatchOptions = defaultMatchOptions
): boolean
type MatchOptions = {
ignoreCase?: boolean // Ignore differences in case
ignoreSpace?: boolean // Ignore spaces in text
ignoreOrder?: boolean // Ignore differences in order
}
// Example:
const arr1 = [1, 2, 3, 4]
const arr2 = [4, 3, 2, 1]
isEqual(arr1, arr2, { ignoreOrder: true }) //=> true
isEqual(arr1, arr2) //=> false