.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / core-js / modules / es.typed-array.slice.js
1 'use strict';
2 var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
3 var speciesConstructor = require('../internals/species-constructor');
4 var fails = require('../internals/fails');
5
6 var aTypedArray = ArrayBufferViewCore.aTypedArray;
7 var aTypedArrayConstructor = ArrayBufferViewCore.aTypedArrayConstructor;
8 var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
9 var $slice = [].slice;
10
11 var FORCED = fails(function () {
12   /* global Int8Array -- safe */
13   new Int8Array(1).slice();
14 });
15
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);
21   var index = 0;
22   var length = list.length;
23   var result = new (aTypedArrayConstructor(C))(length);
24   while (length > index) result[index] = list[index++];
25   return result;
26 }, FORCED);