geoview-core
    Preparing search index...

    Function shallowArrayEqual

    • Performs a shallow equality check between two arrays. Compares each element using Object.is. Returns true if both arrays have the same length and all corresponding elements are strictly equal, false otherwise. Note: This is a shallow comparison. Nested objects or arrays are compared by reference.

      Type Parameters

      • T

        The type of elements in the arrays.

      Parameters

      • a: T[]

        The first array to compare.

      • b: T[]

        The second array to compare.

      Returns boolean

      True if the arrays are shallowly equal, false otherwise.

      const arr1 = [1, 2, 3];
      const arr2 = [1, 2, 3];
      const arr3 = [1, 2, 4];
      shallowArrayEqual(arr1, arr2); // true
      shallowArrayEqual(arr1, arr3); // false