(input: string)
| 21 | }; |
| 22 | |
| 23 | function 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. |