UNPKG

670 BJavaScriptView Raw
1'use strict';
2var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
3var TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS = require('../internals/typed-arrays-constructors-requires-wrappers');
4
5var aTypedArrayConstructor = ArrayBufferViewCore.aTypedArrayConstructor;
6
7// `%TypedArray%.of` method
8// https://tc39.github.io/ecma262/#sec-%typedarray%.of
9ArrayBufferViewCore.exportStatic('of', function of(/* ...items */) {
10 var index = 0;
11 var length = arguments.length;
12 var result = new (aTypedArrayConstructor(this))(length);
13 while (length > index) result[index] = arguments[index++];
14 return result;
15}, TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS);