Skip to content

jonpacker/normalize-pathname

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)

About

normalizes any pathname to one leading slash and no trailing slash

Resources

Stars

Watchers

Forks

Packages

No packages published