import { equals } from "https://deno.land/x/ayonli_jsext@v0.9.72/array/index.ts";
Performs a shallow compare to another array and see if it contains the same elements as this array.
NOTE: This function only performs a shallow comparison, to compare nested objects
in the array, use the equals
function from @ayonli/jsext/object
module instead.
Examples
Example 1
Example 1
import { equals } from "@ayonli/jsext/array";
const arr1 = [1, 2, 3, 4, 5];
const arr2 = [{ foo: "bar" }];
console.log(equals(arr1, [1, 2, 3, 4, 5])); // true
console.log(equals(arr2, [{ foo: "bar" }])); // false, object refs are different