Legend:
- Unmodified
- Added
- Removed
-
imaps-frontend/node_modules/es-abstract/2024/FindViaPredicate.js
r0c6b92a r79a0317 2 2 3 3 var $TypeError = require('es-errors/type'); 4 var isInteger = require('math-intrinsics/isInteger'); 4 5 5 6 var Call = require('./Call'); … … 8 9 var IsCallable = require('./IsCallable'); 9 10 var ToString = require('./ToString'); 10 var Type = require('./Type');11 11 12 var isInteger = require('../helpers/isInteger'); 12 var isObject = require('../helpers/isObject'); 13 14 // https://262.ecma-international.org/15.0/#sec-findviapredicate 13 15 14 16 module.exports = function FindViaPredicate(O, len, direction, predicate, thisArg) { 15 if ( Type(O) !== 'Object') {17 if (!isObject(O)) { 16 18 throw new $TypeError('Assertion failed: Type(O) is not Object'); 17 19 } … … 19 21 throw new $TypeError('Assertion failed: len must be a non-negative integer'); 20 22 } 21 if (direction !== 'ascending' && direction !== 'descending' ) {22 throw new $TypeError('Assertion failed: direction must be "ascending" or "descending"');23 if (direction !== 'ascending' && direction !== 'descending' && direction !== 'DESCENDING' && direction !== 'ASCENDING') { 24 throw new $TypeError('Assertion failed: direction must be ~ASCENDING~ or ~DESCENDING~'); 23 25 } 24 26 … … 28 30 29 31 for ( // steps 2-4 30 var k = direction === 'ascending' ? 0 : len - 1;31 direction === 'ascending' ? k < len : k >= 0;32 var k = direction === 'ascending' || direction === 'ASCENDING' ? 0 : len - 1; 33 direction === 'ascending' || direction === 'ASCENDING' ? k < len : k >= 0; 32 34 k += 1 33 35 ) {
Note:
See TracChangeset
for help on using the changeset viewer.