Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/coderaiser/montag
format multiline strings using tagged templates, instead of puting all lines into an array and joining to a string
https://github.com/coderaiser/montag
javascript join nodejs string tag template
Last synced: about 1 month ago
JSON representation
format multiline strings using tagged templates, instead of puting all lines into an array and joining to a string
- Host: GitHub
- URL: https://github.com/coderaiser/montag
- Owner: coderaiser
- Created: 2020-05-07T13:13:48.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-01-15T17:38:47.000Z (over 1 year ago)
- Last Synced: 2024-07-20T05:10:32.697Z (about 2 months ago)
- Topics: javascript, join, nodejs, string, tag, template
- Language: JavaScript
- Homepage:
- Size: 40 KB
- Stars: 5
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog
Awesome Lists containing this project
README
# Montag [![License][LicenseIMGURL]][LicenseURL] [![NPM version][NPMIMGURL]][NPMURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL] [![Coverage][CoverageIMGURL]][CoverageURL]
> “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](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#Tagged_templates), instead of putting all lines into an array and joining to a string. Use [@putout/plugin-montag](https://github.com/coderaiser/putout/tree/master/packages/plugin-montag) to convert existing code to `montag`.
## Install
```
npm i montag
```## How to use?
```js
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
[NPMIMGURL]: https://img.shields.io/npm/v/montag.svg?style=flat&longCache=true
[BuildStatusIMGURL]: https://img.shields.io/travis/coderaiser/montag/master.svg?style=flat&longCache=true
[LicenseIMGURL]: https://img.shields.io/badge/license-MIT-317BF9.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/montag "npm"
[BuildStatusURL]: https://travis-ci.org/coderaiser/montag "Build Status"
[LicenseURL]: https://tldrlegal.com/license/mit-license "MIT License"
[CoverageURL]: https://coveralls.io/github/coderaiser/montag?branch=master
[CoverageIMGURL]: https://coveralls.io/repos/coderaiser/montag/badge.svg?branch=master&service=github