Initial commit
[yaffs-website] / node_modules / normalize-path / README.md
1 # normalize-path [![NPM version](https://badge.fury.io/js/normalize-path.svg)](http://badge.fury.io/js/normalize-path)  [![Build Status](https://travis-ci.org/jonschlinkert/normalize-path.svg)](https://travis-ci.org/jonschlinkert/normalize-path)
2
3 > Normalize file path slashes to be unix-like forward slashes. Also condenses repeat slashes to a single slash and removes and trailing slashes.
4
5 ## Install
6
7 Install with [npm](https://www.npmjs.com/)
8
9 ```sh
10 $ npm i normalize-path --save
11 ```
12
13 ## Usage
14
15 ```js
16 var normalize = require('normalize-path');
17
18 normalize('\\foo\\bar\\baz\\');
19 //=> '/foo/bar/baz'
20
21 normalize('./foo/bar/baz/');
22 //=> './foo/bar/baz'
23 ```
24
25 Pass `false` as the last argument to **not** strip trailing slashes:
26
27 ```js
28 normalize('./foo/bar/baz/', false);
29 //=> './foo/bar/baz/'
30
31 normalize('foo\\bar\\baz\\', false);
32 //=> 'foo/bar/baz/'
33 ```
34
35 ## Related
36
37 Other useful libraries for working with paths in node.js:
38
39 * [contains-path](https://www.npmjs.com/package/contains-path): Return true if a file path contains the given path. | [homepage](https://github.com/jonschlinkert/contains-path)
40 * [ends-with](https://www.npmjs.com/package/ends-with): Returns `true` if the given `string` or `array` ends with `suffix` using strict equality for… [more](https://www.npmjs.com/package/ends-with) | [homepage](https://github.com/jonschlinkert/ends-with)
41 * [is-absolute](https://www.npmjs.com/package/is-absolute): Returns true if a file path is absolute. | [homepage](https://github.com/jonschlinkert/is-absolute)
42 * [is-relative](https://www.npmjs.com/package/is-relative): Returns `true` if the path appears to be relative. | [homepage](https://github.com/jonschlinkert/is-relative)
43 * [parse-filepath](https://www.npmjs.com/package/parse-filepath): Parse a filepath into an object. Falls back on the native node.js `path.parse` method if… [more](https://www.npmjs.com/package/parse-filepath) | [homepage](https://github.com/jonschlinkert/parse-filepath)
44 * [path-ends-with](https://www.npmjs.com/package/path-ends-with): Return `true` if a file path ends with the given string/suffix. | [homepage](https://github.com/jonschlinkert/path-ends-with)
45 * [path-segments](https://www.npmjs.com/package/path-segments): Get n specific segments of a file path, e.g. first 2, last 3, etc. | [homepage](https://github.com/jonschlinkert/path-segments)
46 * [rewrite-ext](https://www.npmjs.com/package/rewrite-ext): Automatically re-write the destination extension of a filepath based on the source extension. e.g … [more](https://www.npmjs.com/package/rewrite-ext) | [homepage](https://github.com/jonschlinkert/rewrite-ext)
47 * [unixify](https://www.npmjs.com/package/unixify): Convert Windows file paths to unix paths. | [homepage](https://github.com/jonschlinkert/unixify)
48
49 ## Running tests
50
51 Install dev dependencies:
52
53 ```sh
54 $ npm i -d && npm test
55 ```
56
57 ## Contributing
58
59 Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/normalize-path/issues/new).
60
61 ## Author
62
63 **Jon Schlinkert**
64
65 + [github/jonschlinkert](https://github.com/jonschlinkert)
66 + [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
67
68 ## License
69
70 Copyright © 2015 Jon Schlinkert
71 Released under the MIT license.
72
73 ***
74
75 _This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on November 17, 2015._