coderaiser / montag

format multiline strings using tagged templates, instead of puting all lines into an array and joining to a string

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Montag License NPM version Build Status Coverage

“If you don’t want a house built, hide the nails and wood. If you don’t want a man unhappy politically, don’t give him two sides to a question to worry him; give him one. Better yet, give him none.”

(c) Ray Bradbury "Fahrenheit 451"

Format multiline strings using tagged templates, instead of putting all lines into an array and joining to a string. Use @putout/plugin-montag to convert existing code to montag.

Install

npm i montag

How to use?

const montag = require('montag');

const str1 = montag`
    if (a > b)
        console.log(c);
`;

const str2 = [
    'if (a > b)',
    '    console.log(c)',
].join('\n');

str1 === str2;
// returns
true;

License

MIT

About

format multiline strings using tagged templates, instead of puting all lines into an array and joining to a string


Languages

Language:JavaScript 100.0%