You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

readme.md 953B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. # trim-newlines [![Build Status](https://travis-ci.org/sindresorhus/trim-newlines.svg?branch=master)](https://travis-ci.org/sindresorhus/trim-newlines)
  2. > Trim [newlines](https://en.wikipedia.org/wiki/Newline) from the start and/or end of a string
  3. ## Install
  4. ```
  5. $ npm install --save trim-newlines
  6. ```
  7. ## Usage
  8. ```js
  9. var trimNewlines = require('trim-newlines');
  10. trimNewlines('\nunicorn\r\n');
  11. //=> 'unicorn'
  12. ```
  13. ## API
  14. ### trimNewlines(input)
  15. Trim from the start and end of a string.
  16. ### trimNewlines.start(input)
  17. Trim from the start of a string.
  18. ### trimNewlines.end(input)
  19. Trim from the end of a string.
  20. ## Related
  21. - [trim-left](https://github.com/sindresorhus/trim-left) - Similar to `String#trim()` but removes only whitespace on the left
  22. - [trim-right](https://github.com/sindresorhus/trim-right) - Similar to `String#trim()` but removes only whitespace on the right.
  23. ## License
  24. MIT © [Sindre Sorhus](http://sindresorhus.com)