Welcome to mirror list, hosted at ThFree Co, Russian Federation.

readme.md « trim-trailing-lines « node_modules « eslint « node_modules « tools - github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a9c1f441b842627b3cb28b5b22764440ec6e5921 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# trim-trailing-lines

[![Build][build-badge]][build]
[![Coverage][coverage-badge]][coverage]
[![Downloads][downloads-badge]][downloads]
[![Size][size-badge]][size]

Remove final line feeds from a string.

## Install

[npm][]:

```sh
npm install trim-trailing-lines
```

## Use

```js
var trimTrailingLines = require('trim-trailing-lines')

trimTrailingLines('foo\nbar') // => 'foo\nbar'
trimTrailingLines('foo\nbar\n') // => 'foo\nbar'
trimTrailingLines('foo\nbar\n\n') // => 'foo\nbar'
```

## API

### `trimTrailingLines(value)`

Remove final line feed characters from `value`.

###### Parameters

*   `value` (`string`) — Value with trailing line feeds, coerced to string.

###### Returns

`string` — Value without trailing newlines.

## License

[MIT][license] © [Titus Wormer][author]

<!-- Definitions -->

[build-badge]: https://img.shields.io/travis/wooorm/trim-trailing-lines.svg

[build]: https://travis-ci.org/wooorm/trim-trailing-lines

[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/trim-trailing-lines.svg

[coverage]: https://codecov.io/github/wooorm/trim-trailing-lines

[downloads-badge]: https://img.shields.io/npm/dm/trim-trailing-lines.svg

[downloads]: https://www.npmjs.com/package/trim-trailing-lines

[size-badge]: https://img.shields.io/bundlephobia/minzip/trim-trailing-lines.svg

[size]: https://bundlephobia.com/result?p=trim-trailing-lines

[npm]: https://docs.npmjs.com/cli/install

[license]: license

[author]: https://wooorm.com