Accept all input types

This commit is contained in:
Kai Jellinghaus
2022-11-24 21:10:24 +01:00
parent 8c06a4bc96
commit 447ab42154
+9 -2
View File
@@ -192,8 +192,14 @@ export async function resolve(inputs: string[]): Promise<Record<string, any>> {
data = input;
} else {
const key = input.split("=", 1)[0];
const value = JSON.parse(input.substring(key.length + 1));
data = JSON.stringify(Object.fromEntries([[key, value]]));
const value = input.substring(key.length + 1);
let o;
try {
o = JSON.parse(value);
} catch {
o = value;
}
data = JSON.stringify(Object.fromEntries([[key, o]]));
}
}
let jsonObj;
@@ -202,6 +208,7 @@ export async function resolve(inputs: string[]): Promise<Record<string, any>> {
} catch {
jsonObj = data;
}
console.log(jsonObj);
result = { ...result, ...jsonObj };
}
return result;