Submit
Path:
~
/
/
usr
/
share
/
nodejs
/
es-abstract
/
2020
/
File Content:
CreateRegExpStringIterator.js
'use strict'; var GetIntrinsic = require('get-intrinsic'); var hasSymbols = require('has-symbols')(); var $TypeError = GetIntrinsic('%TypeError%'); var IteratorPrototype = GetIntrinsic('%IteratorPrototype%', true); var $defineProperty = GetIntrinsic('%Object.defineProperty%', true); var AdvanceStringIndex = require('./AdvanceStringIndex'); var CreateIterResultObject = require('./CreateIterResultObject'); var CreateMethodProperty = require('./CreateMethodProperty'); var Get = require('./Get'); var OrdinaryObjectCreate = require('./OrdinaryObjectCreate'); var RegExpExec = require('./RegExpExec'); var Set = require('./Set'); var ToLength = require('./ToLength'); var ToString = require('./ToString'); var Type = require('./Type'); var SLOT = require('internal-slot'); var RegExpStringIterator = function RegExpStringIterator(R, S, global, fullUnicode) { if (Type(S) !== 'String') { throw new $TypeError('`S` must be a string'); } if (Type(global) !== 'Boolean') { throw new $TypeError('`global` must be a boolean'); } if (Type(fullUnicode) !== 'Boolean') { throw new $TypeError('`fullUnicode` must be a boolean'); } SLOT.set(this, '[[IteratingRegExp]]', R); SLOT.set(this, '[[IteratedString]]', S); SLOT.set(this, '[[Global]]', global); SLOT.set(this, '[[Unicode]]', fullUnicode); SLOT.set(this, '[[Done]]', false); }; if (IteratorPrototype) { RegExpStringIterator.prototype = OrdinaryObjectCreate(IteratorPrototype); } var RegExpStringIteratorNext = function next() { var O = this; // eslint-disable-line no-invalid-this if (Type(O) !== 'Object') { throw new $TypeError('receiver must be an object'); } if ( !(O instanceof RegExpStringIterator) || !SLOT.has(O, '[[IteratingRegExp]]') || !SLOT.has(O, '[[IteratedString]]') || !SLOT.has(O, '[[Global]]') || !SLOT.has(O, '[[Unicode]]') || !SLOT.has(O, '[[Done]]') ) { throw new $TypeError('"this" value must be a RegExpStringIterator instance'); } if (SLOT.get(O, '[[Done]]')) { return CreateIterResultObject(undefined, true); } var R = SLOT.get(O, '[[IteratingRegExp]]'); var S = SLOT.get(O, '[[IteratedString]]'); var global = SLOT.get(O, '[[Global]]'); var fullUnicode = SLOT.get(O, '[[Unicode]]'); var match = RegExpExec(R, S); if (match === null) { SLOT.set(O, '[[Done]]', true); return CreateIterResultObject(undefined, true); } if (global) { var matchStr = ToString(Get(match, '0')); if (matchStr === '') { var thisIndex = ToLength(Get(R, 'lastIndex')); var nextIndex = AdvanceStringIndex(S, thisIndex, fullUnicode); Set(R, 'lastIndex', nextIndex, true); } return CreateIterResultObject(match, false); } SLOT.set(O, '[[Done]]', true); return CreateIterResultObject(match, false); }; CreateMethodProperty(RegExpStringIterator.prototype, 'next', RegExpStringIteratorNext); if (hasSymbols) { if (Symbol.toStringTag) { if ($defineProperty) { $defineProperty(RegExpStringIterator.prototype, Symbol.toStringTag, { configurable: true, enumerable: false, value: 'RegExp String Iterator', writable: false }); } else { RegExpStringIterator.prototype[Symbol.toStringTag] = 'RegExp String Iterator'; } } if (Symbol.iterator && typeof RegExpStringIterator.prototype[Symbol.iterator] !== 'function') { var iteratorFn = function SymbolIterator() { return this; }; CreateMethodProperty(RegExpStringIterator.prototype, Symbol.iterator, iteratorFn); } } // https://262.ecma-international.org/11.0/#sec-createregexpstringiterator module.exports = function CreateRegExpStringIterator(R, S, global, fullUnicode) { // assert R.global === global && R.unicode === fullUnicode? return new RegExpStringIterator(R, S, global, fullUnicode); };
Edit
Rename
Chmod
Delete
FILE
FOLDER
Name
Size
Permission
Action
BigInt
---
0755
Number
---
0755
AbstractEqualityComparison.js
1873 bytes
0644
AbstractRelationalComparison.js
2121 bytes
0644
AddEntriesFromIterable.js
1519 bytes
0644
AdvanceStringIndex.js
983 bytes
0644
ArrayCreate.js
1683 bytes
0644
ArraySetLength.js
2665 bytes
0644
ArraySpeciesCreate.js
1348 bytes
0644
BigIntBitwiseOp.js
1741 bytes
0644
BinaryAnd.js
364 bytes
0644
BinaryOr.js
362 bytes
0644
BinaryXor.js
364 bytes
0644
Call.js
623 bytes
0644
CanonicalNumericIndexString.js
654 bytes
0644
CharacterRange.js
782 bytes
0644
CodePointAt.js
1720 bytes
0644
CompletePropertyDescriptor.js
989 bytes
0644
CopyDataProperties.js
1905 bytes
0644
CreateDataProperty.js
1297 bytes
0644
CreateDataPropertyOrThrow.js
734 bytes
0644
CreateHTML.js
927 bytes
0644
CreateIterResultObject.js
432 bytes
0644
CreateListFromArrayLike.js
1363 bytes
0644
CreateMethodProperty.js
979 bytes
0644
CreateRegExpStringIterator.js
3738 bytes
0644
DateFromTime.js
1036 bytes
0644
DateString.js
1055 bytes
0644
Day.js
234 bytes
0644
DayFromYear.js
256 bytes
0644
DayWithinYear.js
286 bytes
0644
DaysInYear.js
301 bytes
0644
DefinePropertyOrThrow.js
1466 bytes
0644
DeletePropertyOrThrow.js
699 bytes
0644
EnumerableOwnPropertyNames.js
1109 bytes
0644
FlattenIntoArray.js
1752 bytes
0644
FromPropertyDescriptor.js
797 bytes
0644
Get.js
732 bytes
0644
GetIterator.js
1737 bytes
0644
GetMethod.js
922 bytes
0644
GetOwnPropertyKeys.js
817 bytes
0644
GetPrototypeFromConstructor.js
921 bytes
0644
GetSubstitution.js
4417 bytes
0644
GetV.js
569 bytes
0644
HasOwnProperty.js
553 bytes
0644
HasProperty.js
517 bytes
0644
HourFromTime.js
382 bytes
0644
InLeapYear.js
510 bytes
0644
InstanceofOperator.js
918 bytes
0644
Invoke.js
715 bytes
0644
IsAccessorDescriptor.js
465 bytes
0644
IsArray.js
410 bytes
0644
IsBigIntElementType.js
194 bytes
0644
IsCallable.js
108 bytes
0644
IsCompatiblePropertyDescriptor.js
367 bytes
0644
IsConcatSpreadable.js
626 bytes
0644
IsConstructor.js
1149 bytes
0644
IsDataDescriptor.js
464 bytes
0644
IsExtensible.js
504 bytes
0644
IsGenericDescriptor.js
560 bytes
0644
IsInteger.js
450 bytes
0644
IsNoTearConfiguration.js
467 bytes
0644
IsNonNegativeInteger.js
236 bytes
0644
IsPromise.js
485 bytes
0644
IsPropertyKey.js
207 bytes
0644
IsRegExp.js
545 bytes
0644
IsSharedArrayBuffer.js
461 bytes
0644
IsStringPrefix.js
940 bytes
0644
IsUnclampedIntegerElementType.js
328 bytes
0644
IsUnsignedElementType.js
290 bytes
0644
IterableToList.js
627 bytes
0644
IteratorClose.js
1481 bytes
0644
IteratorComplete.js
498 bytes
0644
IteratorNext.js
493 bytes
0644
IteratorStep.js
353 bytes
0644
IteratorValue.js
443 bytes
0644
LengthOfArrayLike.js
495 bytes
0644
MakeDate.js
328 bytes
0644
MakeDay.js
917 bytes
0644
MakeTime.js
698 bytes
0644
MinFromTime.js
396 bytes
0644
MonthFromTime.js
1014 bytes
0644
NumberBitwiseOp.js
757 bytes
0644
NumberToBigInt.js
814 bytes
0644
OrdinaryCreateFromConstructor.js
827 bytes
0644
OrdinaryDefineOwnProperty.js
2390 bytes
0644
OrdinaryGetOwnProperty.js
1257 bytes
0644
OrdinaryGetPrototypeOf.js
539 bytes
0644
OrdinaryHasInstance.js
627 bytes
0644
OrdinaryHasProperty.js
531 bytes
0644
OrdinaryObjectCreate.js
1445 bytes
0644
OrdinarySetPrototypeOf.js
1201 bytes
0644
OrdinaryToPrimitive.js
1065 bytes
0644
PromiseResolve.js
457 bytes
0644
QuoteJSONString.js
1391 bytes
0644
RegExpCreate.js
643 bytes
0644
RegExpExec.js
887 bytes
0644
RequireObjectCoercible.js
70 bytes
0644
SameValue.js
307 bytes
0644
SameValueNonNumeric.js
635 bytes
0644
SameValueZero.js
223 bytes
0644
SecFromTime.js
402 bytes
0644
Set.js
1255 bytes
0644
SetFunctionLength.js
1067 bytes
0644
SetFunctionName.js
1381 bytes
0644
SetIntegrityLevel.js
1850 bytes
0644
SpeciesConstructor.js
844 bytes
0644
SplitMatch.js
874 bytes
0644
StrictEqualityComparison.js
361 bytes
0644
StringCreate.js
1109 bytes
0644
StringGetOwnProperty.js
1382 bytes
0644
StringPad.js
1263 bytes
0644
StringToBigInt.js
581 bytes
0644
SymbolDescriptiveString.js
526 bytes
0644
TestIntegrityLevel.js
1272 bytes
0644
TimeClip.js
468 bytes
0644
TimeFromYear.js
261 bytes
0644
TimeString.js
808 bytes
0644
TimeWithinDay.js
247 bytes
0644
ToBigInt.js
631 bytes
0644
ToBigInt64.js
948 bytes
0644
ToBigUint64.js
703 bytes
0644
ToBoolean.js
130 bytes
0644
ToDateString.js
498 bytes
0644
ToIndex.js
657 bytes
0644
ToInt16.js
260 bytes
0644
ToInt32.js
173 bytes
0644
ToInt8.js
247 bytes
0644
ToInteger.js
331 bytes
0644
ToLength.js
332 bytes
0644
ToNumber.js
2136 bytes
0644
ToNumeric.js
550 bytes
0644
ToObject.js
334 bytes
0644
ToPrimitive.js
287 bytes
0644
ToPropertyDescriptor.js
1452 bytes
0644
ToPropertyKey.js
405 bytes
0644
ToString.js
396 bytes
0644
ToUint16.js
564 bytes
0644
ToUint32.js
175 bytes
0644
ToUint8.js
578 bytes
0644
ToUint8Clamp.js
522 bytes
0644
TrimString.js
804 bytes
0644
Type.js
297 bytes
0644
UTF16DecodeString.js
753 bytes
0644
UTF16DecodeSurrogatePair.js
776 bytes
0644
UTF16Encoding.js
700 bytes
0644
UnicodeEscape.js
839 bytes
0644
ValidateAndApplyPropertyDescriptor.js
5243 bytes
0644
WeekDay.js
208 bytes
0644
YearFromTime.js
407 bytes
0644
abs.js
207 bytes
0644
floor.js
217 bytes
0644
modulo.js
168 bytes
0644
msFromTime.js
253 bytes
0644
thisBigIntValue.js
551 bytes
0644
thisBooleanValue.js
367 bytes
0644
thisNumberValue.js
390 bytes
0644
thisStringValue.js
361 bytes
0644
thisSymbolValue.js
514 bytes
0644
thisTimeValue.js
66 bytes
0644
N4ST4R_ID | Naxtarrr