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

Function sanitizeInput

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

Source from the content-addressed store, hash-verified

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