2 var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
3 var speciesConstructor = require('../internals/species-constructor');
4 var fails = require('../internals/fails');
6 var aTypedArray = ArrayBufferViewCore.aTypedArray;
7 var aTypedArrayConstructor = ArrayBufferViewCore.aTypedArrayConstructor;
8 var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
11 var FORCED = fails(function () {
12 /* global Int8Array -- safe */
13 new Int8Array(1).slice();
16 // `%TypedArray%.prototype.slice` method
17 // https://tc39.es/ecma262/#sec-%typedarray%.prototype.slice
18 exportTypedArrayMethod('slice', function slice(start, end) {
19 var list = $slice.call(aTypedArray(this), start, end);
20 var C = speciesConstructor(this, this.constructor);
22 var length = list.length;
23 var result = new (aTypedArrayConstructor(C))(length);
24 while (length > index) result[index] = list[index++];