Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
locales.forEach((locale) => {
const dirname = path.join(destination, locale);
try {
mkdirp.sync(dirname);
} catch (err) {
console.error(err);
}
fs.writeFileSync(`${dirname}.json`, JSON.stringify(getKeyValJson(localesRows, locale), null, 2)); // eslint-disable-line max-len
// fs.writeFileSync(`${dirname}/translation.json`, JSON.stringify(getKeyValJson(localesRows, locale), null, 2)); // eslint-disable-line max-len
const namespaces = groupBy(localesRows, 'ns');
forEach(namespaces, (rows, ns) => {
if (!ns) return;
fs.writeFileSync(`${dirname}/${ns}.json`, JSON.stringify(getKeyValJson(rows, locale), null, 2));
});
});
};
forEach(namespaces, (rows, ns) => {
if (!ns) return;
fs.writeFileSync(`${dirname}/${ns}.json`, JSON.stringify(getKeyValJson(rows, locale), null, 2));
});
});