replace path string to valid path, escaping all spacial characters and spaces to underscore(
_
), which will be useful generating urls.
$ npm install --save path-replace
const str = `test~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\ \\/test2`;
assert.equal(pathReplace(str), 'test_test2');
Apache-2.0 © chilijung