MCPcopy Create free account
hub / github.com/bclinkinbeard/angular / encodeUriQuery

Function encodeUriQuery

test/fixtures/foo.js:1272–1279  ·  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 http://tools.ietf.org/html/rfc3986: * query = *( pchar / "/" / "?" ) * pcha

(val, pctEncodeSpaces)

Source from the content-addressed store, hash-verified

1270 * / "*" / "+" / "," / ";" / "="
1271 */
1272function encodeUriQuery(val, pctEncodeSpaces) {
1273 return encodeURIComponent(val).
1274 replace(/%40/gi, '@').
1275 replace(/%3A/gi, ':').
1276 replace(/%24/g, '$').
1277 replace(/%2C/gi, ',').
1278 replace(/%20/g, (pctEncodeSpaces ? '%20' : '+'));
1279}
1280
1281
1282/**

Callers 3

toKeyValueFunction · 0.85
encodeUriSegmentFunction · 0.85
buildUrlFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected