Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function stringifyObject(obj, inline, lvl) {
if (Object.keys(obj).length > 0 || obj.length > 0) {
// eslint-disable-next-line array-callback-return
obj = traverse(obj).map(function(value) {
if (isValidElement(value) || this.isLeaf) {
this.update(formatValue(value, inline, lvl));
}
});
obj = sortobject(obj);
}
const stringified = stringify(obj);
if (inline) {
return collapse(stringified)
.replace(/{ /g, '{')
.replace(/ }/g, '}')
.replace(/\[ /g, '[')
.replace(/ ]/g, ']');
}
// Replace tabs with spaces, and add necessary indentation in front of each new line
return stringified
.replace(/\\\'/g, "'")
.replace(/\t/g, spacer(1, tabStop))
Object.keys(namespaces).forEach((ns) => {
// Deeply sort an object by its keys without mangling any arrays inside of it
resStore[lng][ns] = sortObject(namespaces[ns]);
});
});