diff --git a/lib/v8.js b/lib/v8.js index f4fe88346b0b63..1dc3cb394963ab 100644 --- a/lib/v8.js +++ b/lib/v8.js @@ -17,6 +17,8 @@ const { Array, ArrayBuffer, + ArrayPrototypeForEach, + ArrayPrototypePush, DataView, Error, Float32Array, @@ -185,13 +187,14 @@ const arrayBufferViewTypeToIndex = new SafeMap(); { const dummy = new ArrayBuffer(); - for (const [i, ctor] of arrayBufferViewTypes.entries()) { + ArrayPrototypeForEach(arrayBufferViewTypes, (ctor, i) => { const tag = ObjectPrototypeToString(new ctor(dummy)); arrayBufferViewTypeToIndex.set(tag, i); - } + }); } -const bufferConstructorIndex = arrayBufferViewTypes.push(FastBuffer) - 1; +const bufferConstructorIndex = + ArrayPrototypePush(arrayBufferViewTypes, FastBuffer) - 1; class DefaultSerializer extends Serializer { constructor() {