MCPcopy Create free account
hub / github.com/angular/angular / setUrlDerivedKey

Function setUrlDerivedKey

packages/router/src/url_tree.ts:655–662  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

653 * Indices below 32 use little space, so leave them alone.
654 */
655function 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
664const SEGMENT_RE = /^[^\/()?;#]+/;
665function matchSegments(str: string): string {

Callers 3

parseParamMethod · 0.85
parseParensMethod · 0.85
squashSegmentGroupFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected