trim-trailing-lines
Remove final line feeds from a string
Last updated 5 years ago by wooorm .
MIT · Repository · Bugs · Original npm
$ cnpm install trim-trailing-lines 
SYNC missed versions from official npm registry.

trim-trailing-lines

Build Coverage Downloads Size

Remove final line feeds from a string.

Install

This package is ESM only: Node 12+ is needed to use it and it must be imported instead of required.

npm:

npm install trim-trailing-lines

Use

import {trimTrailingLines} from 'trim-trailing-lines'

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

API

This package exports the following identifiers: trimTrailingLines. There is no default export.

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 © Titus Wormer

Current Tags

  • 2.0.0                                ...           latest (4 years ago)

4 Versions

  • 2.0.0                                ...           4 years ago
  • 1.1.4                                ...           5 years ago
  • 1.1.2                                ...           6 years ago
  • 1.1.3                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (8)
Dependents (0)
None

Copyright 2013 - present © cnpmjs.org