-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimplementation.js
More file actions
25 lines (17 loc) · 751 Bytes
/
implementation.js
File metadata and controls
25 lines (17 loc) · 751 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
'use strict';
var Get = require('es-abstract/2025/Get');
var ToIntegerOrInfinity = require('es-abstract/2025/ToIntegerOrInfinity');
var ToString = require('es-abstract/2025/ToString');
var TypedArrayLength = require('es-abstract/2025/TypedArrayLength');
var ValidateTypedArray = require('es-abstract/2025/ValidateTypedArray');
module.exports = function at(index) {
var O = this; // step 1
var taRecord = ValidateTypedArray(O, 'SEQ-CST'); // step 2
var len = TypedArrayLength(taRecord); // step 3
var relativeIndex = ToIntegerOrInfinity(index); // step 4
var k = relativeIndex >= 0 ? relativeIndex : len + relativeIndex; // step 5-6
if (k < 0 || k >= len) {
return void undefined; // step 7
}
return Get(O, ToString(k)); // step 8
};