Giter Site home page Giter Site logo

archived-tsml's Introduction

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.

archived-tsml's People

Contributors

rvagg avatar fnogatz avatar

Stargazers

 avatar  avatar  avatar  avatar Lee avatar  avatar  avatar yanglf avatar Twilbeter avatar Steve Kellock avatar James Wiens avatar Jeremiah Senkpiel avatar Christian Benseler avatar xutao avatar Nazar Aziz avatar Vaughan Rouesnel avatar Mauro avatar Joseph avatar Mikey avatar Pascal Duez avatar Matteo Collina avatar Josh Johnston avatar Mark Dalgleish avatar Brandon Orther avatar BJR Matos avatar Ondřej Ždych avatar Yosh avatar Tony Pujals avatar Kiyoshi Nomo avatar Francois-Guillaume Ribreau avatar azu avatar  avatar Julian Gruber avatar Athan avatar Jan Olaf Martin avatar Po-Ying Chen avatar Matthew Irish avatar

Watchers

James Cloos avatar  avatar  avatar

Forkers

markrian

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.