1.0.1 • Published 11 years ago

normalize-pathname v1.0.1

Weekly downloads
100
License
-
Repository
-
Last release
11 years ago

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)