Compare commits

...

2 Commits

Author SHA1 Message Date
Deep Tailor
6419fc4678 Merge branch 'master' into plan-accept-json-or-file 2021-03-03 14:06:41 -08:00
Joshi
fd959f748a Accept plans from a file OR from JSON object (couchDB) 2021-03-03 13:44:46 -08:00

View File

@@ -1,10 +1,14 @@
export function getValidatedPlan(domainObject) {
let jsonString = domainObject.selectFile.body;
let body = domainObject.selectFile.body;
let json = {};
try {
json = JSON.parse(jsonString);
} catch (e) {
return json;
if (typeof body === 'string') {
try {
json = JSON.parse(body);
} catch (e) {
return json;
}
} else {
json = body;
}
return json;