Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
if (!jsonRoot[prop]) {
jsonRoot[prop] = {};
}
jsonRoot = jsonRoot[prop];
}
}
jsonUtils.traverseJsonObjects(jsonObj, (obj) => {
Object.keys(obj).forEach((prop) => {
if (!Object.keys(obj[prop]).length) {
obj[prop] = "";
}
});
});
jsonObj = jsonUtils.sortObject(jsonObj);
console.log(util.inspect(jsonObj, { colors: true, depth: null, compact: false }));
const jsonStr = JSON.stringify(jsonObj, null, " ") + "\n";
fs.writeFileSync(path.join(process.cwd(), jsonFilePath), jsonStr, { encoding: "utf8" });
});
console.log(`props?! ${props}`);
continue;
}
for (const prop of props) {
if (!prop || !prop.length) {
console.log(`prop?! ${prop}`);
continue;
}
if (!jsonRoot[prop]) {
jsonRoot[prop] = {};
}
jsonRoot = jsonRoot[prop];
}
}
jsonUtils.traverseJsonObjects(jsonObj, (obj) => {
Object.keys(obj).forEach((prop) => {
if (!Object.keys(obj[prop]).length) {
obj[prop] = "";
}
});
});
jsonObj = jsonUtils.sortObject(jsonObj);
console.log(util.inspect(jsonObj, { colors: true, depth: null, compact: false }));
const jsonStr = JSON.stringify(jsonObj, null, " ") + "\n";
fs.writeFileSync(path.join(process.cwd(), jsonFilePath), jsonStr, { encoding: "utf8" });
});