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.
Returns true if all values in the array are the same
Uses value-based equality checking by default.