Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 3x 1x 3x 3x 3x | /**
* Checks if two Arrays are equal
*
* @example
* ```ts
* const array1 = [1, 2, 3];
* const array2 = [1, 3, 2];
* const result = equal(array1)(array2);
* console.log(result); // false
* ```
*
* @typeParam T - the {@link Array} element type
* @returns `true` if both Arrays have the same elements in the same order, otherwise `false`
*/
export const equal =
<T>(arrayB: ArrayLike<T>) =>
(arrayA: T[]): boolean => {
return (
arrayA.length === arrayB.length &&
arrayA.every((value, index) => value === arrayB[index])
);
};
|