From 13b3ec7f5ef6da0876018189883d49f4ca5e06a9 Mon Sep 17 00:00:00 2001 From: Ryan Harrison Date: Mon, 23 Oct 2023 11:09:53 -0400 Subject: [PATCH] Simplify 'every2DArray' --- src/webgpu/util/math.ts | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/webgpu/util/math.ts b/src/webgpu/util/math.ts index 8f76124ac951..1fb1d1a7ff69 100644 --- a/src/webgpu/util/math.ts +++ b/src/webgpu/util/math.ts @@ -2250,18 +2250,10 @@ export function map2DArray(m: T[][], op: (input: T) => S): S[][] { * @returns a boolean indicating if the test passed for every element */ export function every2DArray(m: T[][], op: (input: T) => boolean): boolean { - const c = m.length; const r = m[0].length; assert( m.every(c => c.length === r), `Unexpectedly received jagged array to map` ); - for (let i = 0; i < c; i++) { - for (let j = 0; j < r; j++) { - if (!op(m[i][j])) { - return false; - } - } - } - return true; + return m.every(col => col.every(el => op(el))); }