MCPcopy Index your code
hub / github.com/nodejs/node / encodeStringified

Function encodeStringified

lib/querystring.js:195–208  ·  view source on GitHub ↗

* @param {string | number | bigint | boolean} v * @param {(v: string) => string} encode * @returns {string}

(v, encode)

Source from the content-addressed store, hash-verified

193 * @returns {string}
194 */
195function encodeStringified(v, encode) {
196 if (typeof v === 'string')
197 return (v.length ? encode(v) : '');
198 if (typeof v === 'number' && NumberIsFinite(v)) {
199 // Values >= 1e21 automatically switch to scientific notation which requires
200 // escaping due to the inclusion of a '+' in the output
201 return (MathAbs(v) < 1e21 ? '' + v : encode('' + v));
202 }
203 if (typeof v === 'bigint')
204 return '' + v;
205 if (typeof v === 'boolean')
206 return v ? 'true' : 'false';
207 return '';
208}
209
210/**
211 * @param {string | number | boolean | null} v

Callers

nothing calls this directly

Calls 1

encodeFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…