Remove empty arrays
parent
6b64aa9fb6
commit
bf9262c351
4
index.js
4
index.js
|
@ -79,7 +79,11 @@ module.exports = function(babel)
|
||||||
delete strings[path.hub.file.opts.filename];
|
delete strings[path.hub.file.opts.filename];
|
||||||
const arrays = { ...strings };
|
const arrays = { ...strings };
|
||||||
for (let k in arrays)
|
for (let k in arrays)
|
||||||
|
{
|
||||||
arrays[k] = Object.keys(arrays[k]);
|
arrays[k] = Object.keys(arrays[k]);
|
||||||
|
if (!arrays[k].length)
|
||||||
|
delete arrays[k];
|
||||||
|
}
|
||||||
fs.writeFileSync(
|
fs.writeFileSync(
|
||||||
path.hub.file.opts.root+'/'+(state.opts['output'] || 'react-translate-output.json'),
|
path.hub.file.opts.root+'/'+(state.opts['output'] || 'react-translate-output.json'),
|
||||||
JSON.stringify(arrays, null, 2)
|
JSON.stringify(arrays, null, 2)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "babel-plugin-react-translate",
|
"name": "babel-plugin-react-translate",
|
||||||
"version": "1.0.1",
|
"version": "1.0.2",
|
||||||
"description": "Babel-based JS/JSX auto-translator for Russian language",
|
"description": "Babel-based JS/JSX auto-translator for Russian language",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
Loading…
Reference in New Issue