npm.io
2.0.0 • Published 1 month ago

tsheredoc

Licence
MIT
Version
2.0.0
Deps
0
Size
6 kB
Vulns
0
Weekly
0
Stars
7

tsheredoc

NPM version Build Status semantic-release

What is it?

This makes is so you can generate multi-line strings without messing up your indents in Javascript/Typescript:

import heredoc from 'tsheredoc';

const usage = heredoc`
   Usage: mycommand [arguments]
   Does cool stuff.
`;
// Usage will be "Usage: mycommand [arguments]\nDoes cool stuff.\n"

This can be used either as a template string (as above) or as a function:

import heredoc from 'tsheredoc';

const usage = heredoc(`
   Usage: mycommand [arguments]
   Does cool stuff.
`);
// Same as above

Keywords