Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

tsmlb

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tsmlb

ES6 template string tag for multi-line blocks of text.

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

tsmlb

ES6 template string tag for multi-line blocks of text.

This template string tag allows you to create nicely formatted text blocks which are indented to match your code.

For example, by default, this...

function x(y) {
  return `
    This ${y} is 
         some
    very fancy
         formatted
    text!
  `;
}

x('right here');

...yields...


    This right here is 
         some
    very fancy
         formatted
    text!

...when you may have wanted...

This right here is 
     some
very fancy
     formatted
text!

...but you didn't want to write...

function x(y) {
  return `This ${y} is 
     some
very fancy
     formatted
text!`;
}

x('right here');

This is what tsmlb provides: the desired result above while maintaining the more readable code in the first block!

var tsmlb = require('tsmlb');

function x(y) {
  return tsmlb`
    This ${y} is 
         some
    very fancy
         formatted
    text!
  `;
}

x('right here');

Tabs or Spaces

tsmlb supports multi-line strings indented with either spaces or tabs, but no accommodation is made for a mix of the two.

Compatibility

Support for template strings exists in Node as of 4.0.0, but this module is not tied to that engine in package.json because Babel users should be able to use it on many other platforms (including the browser).

Inspiration

If you didn't guess from the name, this module is inspired by Rod Vagg's tsml, which is similar except it takes a multi-line template string and returns a single line string. It's also very useful!

License

tsmlb is Copyright (c) 2015 Pat O'Neill and licensed under the MIT license.

Keywords

template

FAQs

Package last updated on 21 Nov 2015

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