(rawInputData: string, source: string)
| 26 | |
| 27 | |
| 28 | export function parseJSONOrYAML<T>(rawInputData: string, source: string): T { |
| 29 | const data = yaml.load(rawInputData) |
| 30 | if (!data) { |
| 31 | return fatalError(`did not get any data from ${source}`) |
| 32 | } |
| 33 | if (typeof data === 'string') { |
| 34 | return fatalError(`got simple string from ${source}`) |
| 35 | } |
| 36 | return data as unknown as T |
| 37 | } |
| 38 | |
| 39 | export function readDataFromStdin(): Promise<string> { |
| 40 | return new Promise((resolve, reject) => { |
no test coverage detected