| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -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); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -597,4 +597,7 @@ declare namespace primordials { | |||
| 597 | 597 | export const PromisePrototypeThen: UncurryThis<typeof Promise.prototype.then> | |
| 598 | 598 | export const PromisePrototypeCatch: UncurryThis<typeof Promise.prototype.catch> | |
| 599 | 599 | export const PromisePrototypeFinally: UncurryThis<typeof Promise.prototype.finally> | |
| 600 | + export import Proxy = globalThis.Proxy | ||
| 601 | + import _globalThis = globalThis | ||
| 602 | + export { _globalThis as globalThis } | ||
| 600 | 603 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments