Returns true if all values in the array are the same
Uses value-based equality checking by default.
import { Arrays } from 'https://unpkg.com/ixfx/dist/data.js';const a1 = [ 10, 10, 10 ];Arrays.isContentsTheSame(a1); // Trueconst a2 = [ { name:`Jane` }, { name:`John` } ];Arrays.isContentsTheSame(a2); // True, even though object references are different Copy
import { Arrays } from 'https://unpkg.com/ixfx/dist/data.js';const a1 = [ 10, 10, 10 ];Arrays.isContentsTheSame(a1); // Trueconst 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);}); Copy
Arrays.isContentsTheSame(someArray, (a, b) => { return (a.eventType === b.eventType);});
Returns true if array is empty.
array
Array
Optional
Equality checker. Uses string-conversion checking by default
Returns true if all values in the array are the same
Uses value-based equality checking by default.
Example: Uses default equality function:
If we want to compare by value for objects that aren't readily converted to JSON, you need to provide a function:
Returns true if
array
is empty.