ixfx
    Preparing search index...

    Function isContentsTheSame

    • 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

      import { Arrays } from 'https://unpkg.com/ixfx/dist/data.js';

      const a1 = [ 10, 10, 10 ];
      Arrays.isContentsTheSame(a1); // True

      const a2 = [ { name:`Jane` }, { name:`John` } ];
      Arrays.isContentsTheSame(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:

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

      Returns true if array is empty.