There're several instances of code that could be reduced by using other libraries that already take care of these things to make the code more readable and make's it so we don't have to write as many unit tests.
[x] fs-extra-promisify
This will handle reading and writing files, and ensuring directories exist. Which would remove the need for several different util functions spread out through the different files.
[x] es6-promisify
This will reduce the amount of code that's like this that is just converting a callback style function into a promise style function.
import cson from 'cson';
// parses a cson string
function parseCson(content) {
return new Promise((resolve, reject) => {
// console.log('input.load_cson_file');
cson.parse(content, (err, result) => {
if (err) {
reject(err);
} else {
resolve(result);
}
});
});
}
Would change to be used like this.
import promisify from 'es6-promisify'
import cson from 'cson';
cson.parse = promisify(cson.parse)
[x] to-js
This would provide better type checking and converting of variables. Because there's typeof [] won't return 'array' it will return object
[ ] lodash
This provides an easy way to create nested objects and get nested items from an object using _.get and _.set as well as other useful functions.
There're several instances of code that could be reduced by using other libraries that already take care of these things to make the code more readable and make's it so we don't have to write as many unit tests.
[x]
fs-extra-promisify
This will handle reading and writing files, and ensuring directories exist. Which would remove the need for several different util functions spread out through the different files.[x]
async-array-methods
This will remove all instances of code like thisand change it to be
[x]
es6-promisify
This will reduce the amount of code that's like this that is just converting a callback style function into a promise style function.Would change to be used like this.
[x]
to-js
This would provide better type checking and converting of variables. Because there'stypeof []
won't return'array'
it will returnobject
[ ]
lodash
This provides an easy way to create nested objects and get nested items from an object using_.get
and_.set
as well as other useful functions.