Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit efdf671

Browse files
Trottgibfahn
authored andcommittedJan 24, 2018
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>
1 parent 838e5cc commit efdf671

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed
 

‎test/common/index.js

+14-13
Original file line numberDiff line numberDiff line change
@@ -790,23 +790,24 @@ exports.skipIf32Bits = function skipIf32Bits() {
790790
}
791791
};
792792

793-
const arrayBufferViews = [
794-
Int8Array,
795-
Uint8Array,
796-
Uint8ClampedArray,
797-
Int16Array,
798-
Uint16Array,
799-
Int32Array,
800-
Uint32Array,
801-
Float32Array,
802-
Float64Array,
803-
DataView
804-
];
805-
806793
exports.getArrayBufferViews = function getArrayBufferViews(buf) {
807794
const { buffer, byteOffset, byteLength } = buf;
808795

809796
const out = [];
797+
798+
const arrayBufferViews = [
799+
Int8Array,
800+
Uint8Array,
801+
Uint8ClampedArray,
802+
Int16Array,
803+
Uint16Array,
804+
Int32Array,
805+
Uint32Array,
806+
Float32Array,
807+
Float64Array,
808+
DataView
809+
];
810+
810811
for (const type of arrayBufferViews) {
811812
const { BYTES_PER_ELEMENT = 1 } = type;
812813
if (byteLength % BYTES_PER_ELEMENT === 0) {

0 commit comments

Comments
 (0)
Please sign in to comment.