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

Function sanitizeInput

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

Source from the content-addressed store, hash-verified

33}
34
35function sanitizeInput(input: string) {
36 input = String(input);
37
38 if (input.length > 0) {
39 // Add trailing `\n` if not exists
40 if (!isEOL(input.charCodeAt(input.length - 1))) input += "\n";
41
42 // Strip BOM
43 if (input.charCodeAt(0) === 0xfeff) input = input.slice(1);
44 }
45
46 return input;
47}
48
49/**
50 * 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