UNPKG

normalize-path

Version:

Normalize file path slashes to be unix-like forward slashes, regardless of OS (since in reality Windows doesn't care about slash direction anyway). Also condenses repeat slashes to a single slash and removes and trailing slashes.

33 lines (22 loc) 918 B
# normalize-path [![NPM version](https://badge.fury.io/js/normalize-path.png)](http://badge.fury.io/js/normalize-path) > Normalize file path slashes to be unix-like forward slashes, regardless of OS (since in reality Windows doesn't care about slash direction anyway). Also condenses repeat slashes to a single slash and removes and trailing slashes. ## Install Install with [npm](npmjs.org): ```bash npm i normalize-path --save-dev ``` ## Usage ```js var normalize = require('normalize-path'); console.log(normalize('\\foo\\bar\\baz\\')); //=> '//foo/bar/baz' ``` ## Author **Jon Schlinkert** + [github/jonschlinkert](https://github.com/jonschlinkert) + [twitter/jonschlinkert](http://twitter.com/jonschlinkert) ## License Copyright (c) 2014 Jon Schlinkert, contributors. Released under the MIT license *** _This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on June 25, 2014._