MCPcopy Index your code
hub / github.com/angular/angular / encodeUriQuery

Function encodeUriQuery

packages/common/upgrade/src/params.ts:342–350  ·  view source on GitHub ↗

* This method is intended for encoding *key* or *value* parts of query component. We need a custom * method because encodeURIComponent is too aggressive and encodes stuff that doesn't have to be * encoded per https://tools.ietf.org/html/rfc3986: * query = *( pchar / "/" / "?" ) * p

(val: string, pctEncodeSpaces: boolean = false)

Source from the content-addressed store, hash-verified

340 * Logic from https://github.com/angular/angular.js/blob/864c7f0/src/Angular.js#L1456
341 */
342function encodeUriQuery(val: string, pctEncodeSpaces: boolean = false) {
343 return encodeURIComponent(val)
344 .replace(/%40/g, '@')
345 .replace(/%3A/gi, ':')
346 .replace(/%24/g, '$')
347 .replace(/%2C/gi, ',')
348 .replace(/%3B/gi, ';')
349 .replace(/%20/g, pctEncodeSpaces ? '%20' : '+');
350}

Callers 2

toKeyValueFunction · 0.70
encodeUriSegmentFunction · 0.70

Calls 1

replaceMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…