trim-newlines
Trim newlines from the start and/or end of a string
Last updated 6 years ago by sindresorhus .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install trim-newlines 
SYNC missed versions from official npm registry.

trim-newlines Build Status

Trim newlines from the start and/or end of a string

Install

$ npm install trim-newlines

Usage

const trimNewlines = require('trim-newlines');

trimNewlines('\nšŸ¦„\r\n');
//=> 'šŸ¦„'

trimNewlines.start('\nšŸ¦„\r\n');
//=> 'šŸ¦„\r\n'

trimNewlines.end('\nšŸ¦„\r\n');
//=> '\nšŸ¦„'

API

trimNewlines(string)

Trim from the start and end of a string.

trimNewlines.start(string)

Trim from the start of a string.

trimNewlines.end(string)

Trim from the end of a string.

Related

  • trim-left - Similar to String#trim() but removes only whitespace on the left
  • trim-right - Similar to String#trim() but removes only whitespace on the right.

License

MIT Ā© Sindre Sorhus

Current Tags

  • 3.0.1                                ...           3-0-1 (6 years ago)
  • 5.0.0                                ...           latest (4 years ago)

10 Versions

  • 5.0.0                                ...           4 years ago
  • 4.1.1                                ...           4 years ago
  • 4.1.0                                ...           4 years ago
  • 4.0.2                                ...           5 years ago
  • 3.0.1                                ...           6 years ago
  • 4.0.1                                ...           6 years ago
  • 4.0.0                                ...           6 years ago
  • 3.0.0                                ...           8 years ago
  • 2.0.0                                ...           10 years ago
  • 1.0.0                                ...           11 years ago
Maintainers (1)
Downloads
Total 28
Today 0
This Week 0
This Month 10
Last Day 0
Last Week 9
Last Month 7
Dependencies (0)
None
Dev Dependencies (3)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE