* Avoids oversized V8 backing stores for numeric URL keys. * Setting then deleting the sentinel keeps indexed properties in dictionary storage. * Indices below 32 use little space, so leave them alone.
(target: {[key: string]: T}, key: string, value: T)
| 653 | * Indices below 32 use little space, so leave them alone. |
| 654 | */ |
| 655 | function setUrlDerivedKey<T>(target: {[key: string]: T}, key: string, value: T): void { |
| 656 | // Preserve URL keys that happen to equal the sentinel. |
| 657 | if (Number(key) >= 32 && !Object.hasOwn(target, SLOW_ELEMENTS_SENTINEL)) { |
| 658 | target[SLOW_ELEMENTS_SENTINEL] = value; |
| 659 | delete target[SLOW_ELEMENTS_SENTINEL]; |
| 660 | } |
| 661 | target[key] = value; |
| 662 | } |
| 663 | |
| 664 | const SEGMENT_RE = /^[^\/()?;#]+/; |
| 665 | function matchSegments(str: string): string { |
no outgoing calls
no test coverage detected