normalize-pathname
v1.0.1
Published
normalizes any pathname to one leading slash and no trailing slash
Downloads
160
Readme
normalize-pathname
Normalizes any pathname to the same format: one leading slash, no trailing slash.
install
npm install normalize-pathname
usage
var normalizePathname = require('normalize-pathname');
console.log(normalizePathname('wibblebong/wollomombi/'));
// -> '/wibblebong/wollomombi'
examples
/one/two/ -> /one/two
one/two -> /one/two
one/two/ -> /one/two
one -> /one
/one/ -> /one
one/ -> /one
/ -> (empty string)