source: trip-planner-front/node_modules/normalize-path/README.md@ 76712b2

Last change on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 5.3 KB
Line 
1# normalize-path [![NPM version](https://img.shields.io/npm/v/normalize-path.svg?style=flat)](https://www.npmjs.com/package/normalize-path) [![NPM monthly downloads](https://img.shields.io/npm/dm/normalize-path.svg?style=flat)](https://npmjs.org/package/normalize-path) [![NPM total downloads](https://img.shields.io/npm/dt/normalize-path.svg?style=flat)](https://npmjs.org/package/normalize-path) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/normalize-path.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/normalize-path)
2
3> Normalize slashes in a file path to be posix/unix-like forward slashes. Also condenses repeat slashes to a single slash and removes and trailing slashes, unless disabled.
4
5Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.
6
7## Install
8
9Install with [npm](https://www.npmjs.com/):
10
11```sh
12$ npm install --save normalize-path
13```
14
15## Usage
16
17```js
18const normalize = require('normalize-path');
19
20console.log(normalize('\\foo\\bar\\baz\\'));
21//=> '/foo/bar/baz'
22```
23
24**win32 namespaces**
25
26```js
27console.log(normalize('\\\\?\\UNC\\Server01\\user\\docs\\Letter.txt'));
28//=> '//?/UNC/Server01/user/docs/Letter.txt'
29
30console.log(normalize('\\\\.\\CdRomX'));
31//=> '//./CdRomX'
32```
33
34**Consecutive slashes**
35
36Condenses multiple consecutive forward slashes (except for leading slashes in win32 namespaces) to a single slash.
37
38```js
39console.log(normalize('.//foo//bar///////baz/'));
40//=> './foo/bar/baz'
41```
42
43### Trailing slashes
44
45By default trailing slashes are removed. Pass `false` as the last argument to disable this behavior and _**keep** trailing slashes_:
46
47```js
48console.log(normalize('foo\\bar\\baz\\', false)); //=> 'foo/bar/baz/'
49console.log(normalize('./foo/bar/baz/', false)); //=> './foo/bar/baz/'
50```
51
52## Release history
53
54### v3.0
55
56No breaking changes in this release.
57
58* a check was added to ensure that [win32 namespaces](https://msdn.microsoft.com/library/windows/desktop/aa365247(v=vs.85).aspx#namespaces) are handled properly by win32 `path.parse()` after a path has been normalized by this library.
59* a minor optimization was made to simplify how the trailing separator was handled
60
61## About
62
63<details>
64<summary><strong>Contributing</strong></summary>
65
66Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
67
68</details>
69
70<details>
71<summary><strong>Running Tests</strong></summary>
72
73Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
74
75```sh
76$ npm install && npm test
77```
78
79</details>
80
81<details>
82<summary><strong>Building docs</strong></summary>
83
84_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
85
86To generate the readme, run the following command:
87
88```sh
89$ npm install -g verbose/verb#dev verb-generate-readme && verb
90```
91
92</details>
93
94### Related projects
95
96Other useful path-related libraries:
97
98* [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 "Return true if a file path contains the given path.")
99* [is-absolute](https://www.npmjs.com/package/is-absolute): Returns true if a file path is absolute. Does not rely on the path module… [more](https://github.com/jonschlinkert/is-absolute) | [homepage](https://github.com/jonschlinkert/is-absolute "Returns true if a file path is absolute. Does not rely on the path module and can be used as a polyfill for node.js native `path.isAbolute`.")
100* [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 "Returns `true` if the path appears to be relative.")
101* [parse-filepath](https://www.npmjs.com/package/parse-filepath): Pollyfill for node.js `path.parse`, parses a filepath into an object. | [homepage](https://github.com/jonschlinkert/parse-filepath "Pollyfill for node.js `path.parse`, parses a filepath into an object.")
102* [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 "Return `true` if a file path ends with the given string/suffix.")
103* [unixify](https://www.npmjs.com/package/unixify): Convert Windows file paths to unix paths. | [homepage](https://github.com/jonschlinkert/unixify "Convert Windows file paths to unix paths.")
104
105### Contributors
106
107| **Commits** | **Contributor** |
108| --- | --- |
109| 35 | [jonschlinkert](https://github.com/jonschlinkert) |
110| 1 | [phated](https://github.com/phated) |
111
112### Author
113
114**Jon Schlinkert**
115
116* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert)
117* [GitHub Profile](https://github.com/jonschlinkert)
118* [Twitter Profile](https://twitter.com/jonschlinkert)
119
120### License
121
122Copyright © 2018, [Jon Schlinkert](https://github.com/jonschlinkert).
123Released under the [MIT License](LICENSE).
124
125***
126
127_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on April 19, 2018._
Note: See TracBrowser for help on using the repository browser.