@nrsk/unindent
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

unindent

Build/Test NPM Coverage Supported Node Versions Semantic Release Conventional Commits

Microlibrary for unindenting multiline strings.

Installation

Node

Just use your favorite package manager:

npm i @nrsk/sigma

Deno

You can import the library via Skypack (note that ?dts query parameter, that will pull types as well):

import un from 'https://cdn.skypack.dev/@nrsk/unindent?dts'

Usage

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.
`

console.log(x)

This will output (without 4 leading spaces):

Sup!

  - this is indented
  - this is indented too

This line has the same indentation as the 1st line.

You can use it as an ordinary function too:

import un from '@nrsk/unindent'

const x = un(`...`)

License

MIT.

Package Sidebar

Install

npm i @nrsk/unindent

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

15.5 kB

Total Files

9

Last publish

Collaborators

  • norskeld