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

0.1.1 • Public • Published

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.

Readme

Keywords

Package Sidebar

Install

npm i @jondotsoy/unindent

Weekly Downloads

0

Version

0.1.1

License

MIT

Unpacked Size

18.7 kB

Total Files

11

Last publish

Collaborators

  • jondotsoy