0.1.1 • Published 2 years ago

@jondotsoy/unindent v0.1.1

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

unindent

Remove origin's indentation.

Samples:

// Remove indentation from a text with 2 spaces.
const script = unindent`
  param:
    second_params: 3
`; // => "param:\n  second_params: 3\n"

// Change indentation to 4 spaces
const script = unindent(4)`
  param:
    second_params: 3
`; // => "    param:\n      second_params: 3\n"

Syntax

unindent`text multiline`; // => string
unindent(indentSize)`text multiline`; // => string

unindent(textMultiline); // => string
unindent(indentSize, textMultiline); // => string

Parameters

  • text multiline: Can be used the unindent function as a tagged template.
  • indentSize (number): define the new indentation to the text.
  • textMultiline (string): text to remove indentation

Return value

A string formatted.

0.1.1

2 years ago

0.1.0

2 years ago