Skip to content

isShallowEqual

ts
function Array.isShallowEqual<T, U extends T>(
    target: readonly T[],
    source: readonly U[],
): target is readonly U[]

Returns true if target and source have the same length and their elements are equal using shallow comparison, otherwise returns false.

Example

ts
import { Array } from "@monstermann/array";

Array.isShallowEqual([1, 2, 3], [1, 2, 3]); // true
ts
import { Array } from "@monstermann/array";

pipe([1, 2, 3], Array.isShallowEqual([1, 2, 3])); // true