trim-lines

Remove spaces and tabs around line-breaks

Usage no npm install needed!

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

README

trim-lines

Build Coverage Downloads Size

Remove spaces and tabs around line breaks.

Install

This package is ESM only: Node 12+ is needed to use it and it must be imported instead of required.

npm:

npm install trim-lines

Use

import {trimLines} from 'trim-lines'

trimLines(' foo\t\n\n bar \n\tbaz ') // => ' foo\nbar\nbaz '

API

This package exports the following identifiers: trimLines. There is no default export.

trimLines(value)

Remove initial and final spaces and tabs at the line breaks in value (string). Does not trim initial and final spaces and tabs of the value itself. Returns the trimmed value.

License

MIT © Titus Wormer