trim-newlines
Trim newlines from the start and/or end of a string
Last updated 3 years ago by sindresorhus .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ 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

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

10 Versions

  • 5.0.0                                ...           3 years ago
  • 4.1.1                                ...           3 years ago
  • 4.1.0                                ...           3 years ago
  • 4.0.2                                ...           5 years ago
  • 3.0.1                                ...           5 years ago
  • 4.0.1                                ...           5 years ago
  • 4.0.0                                ...           5 years ago
  • 3.0.0                                ...           7 years ago
  • 2.0.0                                ...           9 years ago
  • 1.0.0                                ...           11 years ago
Maintainers (1)
Downloads
Today 0
This Week 84
This Month 118
Last Day 15
Last Week 54
Last Month 298
Dependencies (0)
None
Dev Dependencies (3)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |