(filename: string)
| 13 | | 'common' // Q&A or command line for input; table format for output |
| 14 | |
| 15 | export function formatFromFilename(filename: string): IOFormat { |
| 16 | const ext = path.extname(filename).toLowerCase() |
| 17 | if (ext === '.yaml' || ext === '.yml') { |
| 18 | return 'yaml' |
| 19 | } |
| 20 | if (ext === '.json') { |
| 21 | return 'json' |
| 22 | } |
| 23 | log4js.getLogger('cli').warn(`could not determine file type from filename "${filename}, assuming YAML`) |
| 24 | return 'yaml' |
| 25 | } |
| 26 | |
| 27 | |
| 28 | export function parseJSONOrYAML<T>(rawInputData: string, source: string): T { |
no outgoing calls
no test coverage detected