Add or remove trailing slash
npm install super-trailing-slash --save
const slash = require('super-trailing-slash');
slash.add('path/to/file'); //=> path/to/file/
slash.add('\\path\\to\\file'); //=> \path\to\file\
// Adds only if necessary
slash.add('path/to/file/'); //=> path/to/file/
slash.remove('path/to/file/'); //=> path/to/file
slash.remove('\\path\\to\\file\\'); //=> \path\to\file
// Removes only if necessary
slash.remove('path/to/file'); //=> path/to/file
You can view the changelog here
super-trailing-slash is open-sourced software licensed under the MIT license