@@ -307,9 +307,21 @@ const {
307
307
WeakSet,
308
308
} = primordials ;
309
309
310
- // Because these functions are used by `makeSafe`, which is exposed
311
- // on the `primordials` object, it's important to use const references
312
- // to the primordials that they use:
310
+
311
+ /**
312
+ * Creates a class that can be safely iterated over.
313
+ *
314
+ * Because these functions are used by `makeSafe`, which is exposed on the
315
+ * `primordials` object, it's important to use const references to the
316
+ * primordials that they use.
317
+ *
318
+ * @template {Iterable} T
319
+ * @template {*} TReturn
320
+ * @template {*} TNext
321
+ * @param {(self: T) => IterableIterator<T> } factory
322
+ * @param {(...args: [] | [TNext]) => IteratorResult<T, TReturn> } next
323
+ * @returns {Iterator<T, TReturn, TNext> }
324
+ */
313
325
const createSafeIterator = ( factory , next ) => {
314
326
class SafeIterator {
315
327
constructor ( iterable ) {
@@ -617,6 +629,10 @@ class RegExpLikeForStringSplitting {
617
629
}
618
630
ObjectSetPrototypeOf ( RegExpLikeForStringSplitting . prototype , null ) ;
619
631
632
+ /**
633
+ * @param {RegExp } pattern
634
+ * @returns {RegExp }
635
+ */
620
636
primordials . hardenRegExp = function hardenRegExp ( pattern ) {
621
637
ObjectDefineProperties ( pattern , {
622
638
[ SymbolMatch ] : {
@@ -706,6 +722,11 @@ primordials.hardenRegExp = function hardenRegExp(pattern) {
706
722
} ;
707
723
708
724
725
+ /**
726
+ * @param {string } str
727
+ * @param {RegExp } regexp
728
+ * @returns {number }
729
+ */
709
730
primordials . SafeStringPrototypeSearch = ( str , regexp ) => {
710
731
regexp . lastIndex = 0 ;
711
732
const match = RegExpPrototypeExec ( regexp , str ) ;
0 commit comments