mltl

1.0.0 • Public • Published

Strip the newlines and indentations out of a multi-line template literal:

function foo() {
  return `
    one
    two
    three
  `
}

compiles to

function foo() {
    return "\n    one\n    two\n    three\n  ";
}

so use mltl:

function foo() {
  return mltl(`
    one
    two
    three
  `)
}
 
console.log(foo()) == // one\ntwo\nthree

mltl(str: string, removeNewLines: boolean): string

  • str is the template literal string to strip from indent whitespace
  • removeNewLines is an option if new lines should be substituted by spaces or left alone

MIT

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.0
    0
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.0
    0

Package Sidebar

Install

npm i mltl

Weekly Downloads

0

Version

1.0.0

License

MIT

Last publish

Collaborators

  • goatslacker