UNPKG

@spaced-out/ui-design-system

Version:
15 lines (12 loc) 346 B
// @flow strict type ItemComparer<Item> = (a: Item, b: Item) => boolean; export function areArraysEqual<Item>( array1: Item[], array2: Item[], itemComparer: ItemComparer<Item> = (a, b) => a === b, ): boolean { return ( array1.length === array2.length && array1.every((value, index) => itemComparer(value, array2[index])) ); }