source: trip-planner-front/node_modules/core-js/modules/es.typed-array.reverse.js@ 8d391a1

Last change on this file since 8d391a1 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 658 bytes
Line 
1'use strict';
2var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
3
4var aTypedArray = ArrayBufferViewCore.aTypedArray;
5var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
6var floor = Math.floor;
7
8// `%TypedArray%.prototype.reverse` method
9// https://tc39.es/ecma262/#sec-%typedarray%.prototype.reverse
10exportTypedArrayMethod('reverse', function reverse() {
11 var that = this;
12 var length = aTypedArray(that).length;
13 var middle = floor(length / 2);
14 var index = 0;
15 var value;
16 while (index < middle) {
17 value = that[index];
18 that[index++] = that[--length];
19 that[length] = value;
20 } return that;
21});
Note: See TracBrowser for help on using the repository browser.