Remove empty arrays

master
Vitaliy Filippov 2021-08-28 17:37:20 +03:00
parent 6b64aa9fb6
commit bf9262c351
2 changed files with 5 additions and 1 deletions

View File

@ -79,7 +79,11 @@ module.exports = function(babel)
delete strings[path.hub.file.opts.filename];
const arrays = { ...strings };
for (let k in arrays)
{
arrays[k] = Object.keys(arrays[k]);
if (!arrays[k].length)
delete arrays[k];
}
fs.writeFileSync(
path.hub.file.opts.root+'/'+(state.opts['output'] || 'react-translate-output.json'),
JSON.stringify(arrays, null, 2)

View File

@ -1,6 +1,6 @@
{
"name": "babel-plugin-react-translate",
"version": "1.0.1",
"version": "1.0.2",
"description": "Babel-based JS/JSX auto-translator for Russian language",
"main": "index.js",
"scripts": {