ixfx
    Preparing search index...

    Function containsIdenticalValues

    • Returns true if all values in the array are the same. Uses value-based equality checking by default.

      Type Parameters

      • V

      Parameters

      • array: readonly V[] | V[]

        Array

      • Optionalequality: IsEqual<V>

        Equality checker. Uses string-conversion checking by default

      Returns boolean

      const a1 = [ 10, 10, 10 ];
      containsIdenticalValues(a1); // True

      const a2 = [ { name:`Jane` }, { name:`John` } ];
      containsIdenticalValues(a2); // True, even though object references are different

      If we want to compare by value for objects that aren't readily converted to JSON, you need to provide a function:

      containsIdenticalValues(someArray, (a, b) => {
      return (a.eventType === b.eventType);
      });

      Returns true if array is empty.