debian-mirror-gitlab/core-js/modules/es.typed-array.of.js
2019-09-25 13:30:05 +05:30

16 lines
670 B
JavaScript

'use strict';
var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
var TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS = require('../internals/typed-arrays-constructors-requires-wrappers');
var aTypedArrayConstructor = ArrayBufferViewCore.aTypedArrayConstructor;
// `%TypedArray%.of` method
// https://tc39.github.io/ecma262/#sec-%typedarray%.of
ArrayBufferViewCore.exportStatic('of', function of(/* ...items */) {
var index = 0;
var length = arguments.length;
var result = new (aTypedArrayConstructor(this))(length);
while (length > index) result[index] = arguments[index++];
return result;
}, TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS);