trim-off-newlines

Similar to String#trim() but removes only newlines

Usage no npm install needed!

<script type="module">
  import trimOffNewlines from 'https://cdn.skypack.dev/trim-off-newlines';
</script>

README

trim-off-newlines Build Status

Similar to String#trim() but removes only newlines

Install

$ npm install --save trim-off-newlines

Usage

var trimOffNewlines = require('trim-off-newlines');

trimOffNewlines('\n\nunicorns\n\n');
//=> 'unicorns'

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 © Steve Mao