1.5 KiB
1.5 KiB
trim-trailing-lines
Remove final line feeds from a string.
Install
npm:
npm install trim-trailing-lines
Use
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.