MCPcopy Create free account
hub / github.com/denoland/std / sanitizeInput

Function sanitizeInput

yaml/unstable_parse.ts:23–35  ·  view source on GitHub ↗
(input: string)

Source from the content-addressed store, hash-verified

21};
22
23function sanitizeInput(input: string) {
24 input = String(input);
25
26 if (input.length > 0) {
27 // Add trailing `\n` if not exists
28 if (!isEOL(input.charCodeAt(input.length - 1))) input += "\n";
29
30 // Strip BOM
31 if (input.charCodeAt(0) === 0xfeff) input = input.slice(1);
32 }
33
34 return input;
35}
36
37/**
38 * Parse and return a YAML string as a parsed YAML document object.

Callers 2

parseFunction · 0.70
parseAllFunction · 0.70

Calls 2

isEOLFunction · 0.90
sliceMethod · 0.45

Tested by

no test coverage detected