Socket
Socket
Sign inDemoInstall

tsml

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tsml

ES6 template string tag for multi-line cleaning - squash multi-line strings into a single line


Version published
Maintainers
1
Created
Source

tsml

ES6 template string tag for multi-line cleaning - squash multi-line strings into a single line

Use template strings to split up complex string creation over multiple lines and have the newlines and newline white-space prefixes cleaned for you.

tsml is primarily for code readability. Split up template strings over newlines, indent or add additional blank lines to space things out.

Example

From changelog-maker:

const tsml = require('tsml')

function toStringSimple (data) {
  return tsml`

    * [${data.sha.substr(0, 10)}] - 
    ${data.semver.length ? '(' + data.semver.join(', ').toUpperCase() + ') ' : ''}
    ${data.revert ? 'Revert "' : ''}
    ${data.group ? data.group + ': ' : ''}
    ${data.summary} 
    ${data.revert ? '"' : ''}
    ${data.author ? '(' + data.author + ') ' : ''}
    ${data.pr}

  `
}

// -> * [7e88a9322c] - src: make accessors immune to context confusion (Ben Noordhuis) #1238

License

tsml is Copyright (c) 2015 Rod Vagg @rvagg and licenced under the MIT licence. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE.md file for more details.

Keywords

FAQs

Package last updated on 10 Jul 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

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