source: frontend/node_modules/es-abstract/2025/SetDataIndex.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 13 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 856 bytes
Line 
1'use strict';
2
3var $TypeError = require('es-errors/type');
4
5var CanonicalizeKeyedCollectionKey = require('./CanonicalizeKeyedCollectionKey');
6var SameValue = require('./SameValue');
7
8var isArray = require('../helpers/IsArray');
9
10// https://262.ecma-international.org/16.0/#sec-setdataindex
11
12module.exports = function SetDataIndex(setData, value) {
13 if (!isArray(setData) && setData !== 'EMPTY') {
14 throw new $TypeError('Assertion failed: `setData` must be a List or ~EMPTY~');
15 }
16
17 var canonValue = CanonicalizeKeyedCollectionKey(value); // step 1
18
19 var size = setData.length; // step 2
20
21 var index = 0; // step 3
22
23 while (index < size) { // step 4
24 var e = setData[index]; // step 4.a
25 if (/* e !== ~EMPTY~ && */ SameValue(e, canonValue)) { // step 4.b
26 return index; // step 4.b.i
27 }
28 index += 1; // step 4.c
29 }
30
31 return 'NOT-FOUND'; // step 5
32};
Note: See TracBrowser for help on using the repository browser.