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
$ cnpm 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

  • 5.0.0                                ...           latest (2 years ago)

6 Versions

  • 5.0.0                                ...           2 years ago
  • 3.0.1                                ...           4 years ago
  • 4.0.2                                ...           4 years ago
  • 3.0.0                                ...           6 years ago
  • 1.0.0                                ...           10 years ago
  • 2.0.0                                ...           8 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 (3)
Dependents (0)
None

Copyright 2013 - present © cnpmjs.org