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

Function removeChars

deps/undici/undici.js:4318–4328  ·  view source on GitHub ↗
(str, leading, trailing, predicate)

Source from the content-addressed store, hash-verified

4316 }
4317 __name(removeASCIIWhitespace, "removeASCIIWhitespace");
4318 function removeChars(str, leading, trailing, predicate) {
4319 let lead = 0;
4320 let trail = str.length - 1;
4321 if (leading) {
4322 while (lead < str.length && predicate(str.charCodeAt(lead))) lead++;
4323 }
4324 if (trailing) {
4325 while (trail > 0 && predicate(str.charCodeAt(trail))) trail--;
4326 }
4327 return lead === 0 && trail === str.length - 1 ? str : str.slice(lead, trail + 1);
4328 }
4329 __name(removeChars, "removeChars");
4330 function serializeJavascriptValueToJSONString(value) {
4331 const result = JSON.stringify(value);

Callers 4

removeASCIIWhitespaceFunction · 0.70
removeHTTPWhitespaceFunction · 0.70
gettingDecodingSplittingFunction · 0.70

Calls 2

sliceMethod · 0.65
predicateFunction · 0.50

Tested by

no test coverage detected