moon-walk

Removes trailing indentation at the start of multiple lines

Usage no npm install needed!

<script type="module">
  import moonWalk from 'https://cdn.skypack.dev/moon-walk';
</script>

README

MoonWalk.JS

Removes trailing indentation in templating strings and other strings with multiple lines.

Usage

Without moonwalk:

function () {
  let y = 0;
  if(true) {
    let x = `
<div>
  <span>OK</span>
  <div>
    <div></div>
  </div>
</div>
`;
 }

With moonwalk:

import moonwalk from 'moon-walk';
let y = 0;
  if(true) {
    let x = moonwalk(`
      <div>
        <span>OK</span>
        <div>
          <div></div>
        </div>
      </div>
    `);
  }