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

trim-newlines

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

Looking to trim all whitespace, not just newlines? Use String#trim(), String#trimStart(), or String#trimEnd().

Install

npm install trim-newlines

Usage

import {trimNewlines, trimNewlinesStart, trimNewlinesEnd} from 'trim-newlines';

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

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

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

API

trimNewlines(string)

Trim from the start and end of a string.

trimNewlinesStart(string)

Trim from the start of a string.

trimNewlinesEnd(string)

Trim from the end of a string.

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