Permalink
Browse files

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).

PR-URL: #17830
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information...
Trott committed Dec 22, 2017
1 parent ad02e0d commit 03b8ac14e7cb535fc7a82188c666b5a2a38d00bc
Showing with 14 additions and 13 deletions.
  1. +14 −13 test/common/index.js
View
@@ -788,23 +788,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) {

0 comments on commit 03b8ac1

Please sign in to comment.