MCPcopy Create free account
hub / github.com/SmartThingsCommunity/smartthings-cli / parseJSONOrYAML

Function parseJSONOrYAML

src/lib/io-util.ts:28–37  ·  view source on GitHub ↗
(rawInputData: string, source: string)

Source from the content-addressed store, hash-verified

26
27
28export 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
39export function readDataFromStdin(): Promise<string> {
40 return new Promise((resolve, reject) => {

Callers 2

readFunction · 0.85
io-util.test.tsFile · 0.85

Calls 1

fatalErrorFunction · 0.85

Tested by

no test coverage detected