• Test whether two arrays are shallowly equal.

    Type Parameters

    • T

    Parameters

    • a: ArrayLike<T>

      The first array-like object to compare.

    • b: ArrayLike<T>

      The second array-like object to compare.

    • Optional fn: ((a, b) => boolean)

      The comparison function to apply to the elements. It should return true if the elements are "equal". The default compares elements using strict === equality.

        • (a, b): boolean
        • Parameters

          Returns boolean

    Returns boolean

    Whether the two arrays are shallowly equal.

    Complexity

    Linear.

    Undefined Behavior

    Modifying the length of the arrays while comparing.

    Example

    import { ArrayExt } from '@lumino/algorithm';

    let d1 = [0, 3, 4, 7, 7, 9];
    let d2 = [0, 3, 4, 7, 7, 9];
    let d3 = [42];
    ArrayExt.shallowEqual(d1, d2); // true
    ArrayExt.shallowEqual(d2, d3); // false