New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

shift-left

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

shift-left

Moves formatted multiline strings to the left without ruining your code's indentation.

  • 0.1.5
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

shift-left

Moves formatted multiline strings to the left without ruining your code's indentation.

Why does this exist?

Have you ever wanted to log a multi-line string? If so, you've probably seen code like this:

function printStuff() {
  console.log(`
This string is all the way to the left in my code file.

  and sometimes {
    it has {
      indentation
    }
  }

I'm doing this because I want it to start all the way to the left when it appears in the console.

But I sure wish it didn't mess with my code's indentation.
  `);
}

If you wish you could preserve your code's indentation without moving your ouput to the right, this library has an answer for you.

Usage

Example code:

import { shiftLeft } from "shift-left";

const recipient = "Bob Loblaw";

const message = shiftLeft`
  I have a lovely little {
    multiline message

    for you

        and you

            and also ${recipient}
  }
`;

console.log(message);

The code above produces the following output:

I have a lovely little {
  multiline message

  for you

      and you

          and also Bob Loblaw
}

FAQs

Package last updated on 04 Mar 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc