From 45126269101bd668fe921d757271f9a8de72d89a Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 22 Dec 2017 15:29:13 -0800 Subject: [PATCH] test: reduce scope of variable in common module arrayBufferViews is used by only one function so scope it to that function (in the common module). --- test/common/index.js | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/test/common/index.js b/test/common/index.js index 1f9c1d7822bbe7..c4afcd0e1e4336 100644 --- a/test/common/index.js +++ b/test/common/index.js @@ -787,23 +787,24 @@ exports.skipIf32Bits = function skipIf32Bits() { } }; -const arrayBufferViews = [ - Int8Array, - Uint8Array, - Uint8ClampedArray, - Int16Array, - Uint16Array, - Int32Array, - Uint32Array, - Float32Array, - Float64Array, - DataView -]; - exports.getArrayBufferViews = function getArrayBufferViews(buf) { const { buffer, byteOffset, byteLength } = buf; const out = []; + + const arrayBufferViews = [ + Int8Array, + Uint8Array, + Uint8ClampedArray, + Int16Array, + Uint16Array, + Int32Array, + Uint32Array, + Float32Array, + Float64Array, + DataView + ]; + for (const type of arrayBufferViews) { const { BYTES_PER_ELEMENT = 1 } = type; if (byteLength % BYTES_PER_ELEMENT === 0) {