Tests whether all elements in an array pass a test implemented by a predicate.
const numbers = [2, 4, 6] as const;const words = ['Ada', 'Grace'] as const;const allEven = Arr.every(numbers, (value) => value % 2 === 0);const allStartWithA = Arr.every(words, (value) => value.startsWith('A'));assert.ok(allEven);assert.notOk(allStartWithA); Copy
const numbers = [2, 4, 6] as const;const words = ['Ada', 'Grace'] as const;const allEven = Arr.every(numbers, (value) => value % 2 === 0);const allStartWithA = Arr.every(words, (value) => value.startsWith('A'));assert.ok(allEven);assert.notOk(allStartWithA);
Tests whether all elements in an array pass a test implemented by a predicate.