8000 GitHub - rvagg/archived-tsml: ES6 template string tag for multi-line cleaning - squash multi-line strings into a single line
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Apr 5, 2018. It is now read-only.
/ archived-tsml Public archive

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

License

Notifications You must be signed in to change notification settings

rvagg/archived-tsml

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  
0