Microlibrary for unindenting multiline strings.
npm install @nrsk/unindent⇤ unindent




Microlibrary for unindenting multiline strings.
Just use your favorite package manager:
``bash`
npm i @nrsk/unindent
You can import the library via [Skypack] (note that ?dts query parameter, that will pull types as well):
`typescript`
import un from 'https://cdn.skypack.dev/@nrsk/unindent?dts'
This library exposes only one function as the default export, which can be used as a [tagged template][tt], or as ordinary unary function:
`typescript
import un from '@nrsk/unindent'
const x = un
Sup!
- this is indented
- this is indented too
This line has the same indentation as the 1st line.
// Or...
const x = un(
Sup!
- this is indented
- this is indented too
This line has the same indentation as the 1st line.)`
x will contain the following (without 4 leading spaces):
`text
Sup!
- this is indented
- this is indented too
This line has the same indentation as the 1st line.
``
MIT.
[commitlint]: https://github.com/conventional-changelog/commitlint
[semantic-release]: https://semantic-release.gitbook.io/semantic-release
[skypack]: https://skypack.dev
[tt]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#tagged_templates