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

Function trimAsciiWhitespace

lib/internal/encoding.js:311–331  ·  view source on GitHub ↗
(label)

Source from the content-addressed store, hash-verified

309// Unfortunately, String.prototype.trim also removes non-ascii whitespace,
310// so we have to do this manually
311function trimAsciiWhitespace(label) {
312 let s = 0;
313 let e = label.length;
314 while (s < e && (
315 label[s] === '\u0009' ||
316 label[s] === '\u000a' ||
317 label[s] === '\u000c' ||
318 label[s] === '\u000d' ||
319 label[s] === '\u0020')) {
320 s++;
321 }
322 while (e > s && (
323 label[e - 1] === '\u0009' ||
324 label[e - 1] === '\u000a' ||
325 label[e - 1] === '\u000c' ||
326 label[e - 1] === '\u000d' ||
327 label[e - 1] === '\u0020')) {
328 e--;
329 }
330 return StringPrototypeSlice(label, s, e);
331}
332
333function getEncodingFromLabel(label) {
334 const enc = encodings.get(label);

Callers 1

getEncodingFromLabelFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…