source: trip-planner-front/node_modules/remove-trailing-separator/readme.md@ 6fe77af

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

initial commit

  • Property mode set to 100644
File size: 1.8 KB
Line 
1# remove-trailing-separator
2
3[![NPM version][npm-img]][npm-url] [![Build Status: Linux][travis-img]][travis-url] [![Build Status: Windows][appveyor-img]][appveyor-url] [![Coverage Status][coveralls-img]][coveralls-url]
4
5Removes all separators from the end of a string.
6
7## Install
8
9```
10npm install remove-trailing-separator
11```
12
13## Examples
14
15```js
16const removeTrailingSeparator = require('remove-trailing-separator');
17
18removeTrailingSeparator('/foo/bar/') // '/foo/bar'
19removeTrailingSeparator('/foo/bar///') // '/foo/bar'
20
21// leaves only/last separator
22removeTrailingSeparator('/') // '/'
23removeTrailingSeparator('///') // '/'
24
25// returns empty string
26removeTrailingSeparator('') // ''
27```
28
29## Notable backslash, or win32 separator behavior
30
31`\` is considered a separator only on WIN32 systems. All POSIX compliant systems
32see backslash as a valid file name character, so it would break POSIX compliance
33to remove it there.
34
35In practice, this means that this code will return different things depending on
36what system it runs on:
37
38```js
39removeTrailingSeparator('\\foo\\')
40// UNIX => '\\foo\\'
41// WIN32 => '\\foo'
42```
43
44[npm-url]: https://npmjs.org/package/remove-trailing-separator
45[npm-img]: https://badge.fury.io/js/remove-trailing-separator.svg
46[travis-url]: https://travis-ci.org/darsain/remove-trailing-separator
47[travis-img]: https://travis-ci.org/darsain/remove-trailing-separator.svg?branch=master
48[appveyor-url]: https://ci.appveyor.com/project/darsain/remove-trailing-separator/branch/master
49[appveyor-img]: https://ci.appveyor.com/api/projects/status/wvg9a93rrq95n2xl/branch/master?svg=true
50[coveralls-url]: https://coveralls.io/github/darsain/remove-trailing-separator?branch=master
51[coveralls-img]: https://coveralls.io/repos/github/darsain/remove-trailing-separator/badge.svg?branch=master
Note: See TracBrowser for help on using the repository browser.