Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stevemao/trim-off-newlines
Similar to String#trim() but removes only newlines
https://github.com/stevemao/trim-off-newlines
Last synced: 2 months ago
JSON representation
Similar to String#trim() but removes only newlines
- Host: GitHub
- URL: https://github.com/stevemao/trim-off-newlines
- Owner: stevemao
- License: mit
- Created: 2015-09-18T00:46:25.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2022-01-15T15:59:33.000Z (almost 3 years ago)
- Last Synced: 2024-10-19T20:06:37.109Z (3 months ago)
- Language: JavaScript
- Homepage:
- Size: 11.7 KB
- Stars: 8
- Watchers: 6
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# trim-off-newlines [![Build Status](https://travis-ci.org/stevemao/trim-off-newlines.svg?branch=master)](https://travis-ci.org/stevemao/trim-off-newlines)
> Similar to [`String#trim()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim) but removes only newlines
## Install
```
$ npm install --save trim-off-newlines
```## Usage
```js
var trimOffNewlines = require('trim-off-newlines');trimOffNewlines('\n\nunicorns\n\n');
//=> 'unicorns'
```## Related
- [`trim-left`](https://github.com/sindresorhus/trim-left) - Similar to `String#trim()` but removes only whitespace on the left
- [`trim-right`](https://github.com/sindresorhus/trim-right) - Similar to `String#trim()` but removes only whitespace on the right## License
MIT © [Steve Mao](https://github.com/stevemao)