A tiny module to clean a directory selecting which files or directories to keep.
$ npm install --save clean-directory
const invert = require('clean-directory');
// empty the directory
clean('/path/to/dir');
// empty the directory keeping a and its contents
clean('/dir', 'a/**');
// multiple patterns are possible
clean('/dir', ['a/**', 'b/**']);
You just have to clone the repo and run
$ npm test
$ npm run coverage