If this package reaches anyone from NPM, please let me know if we could change the name to
multilinestring
.
The missing template literal for NodeJS.
multilines
removes all spaces before |
character and first space after if present.
- 💅 Prettier code style: You no longer have to care about spaces in multiline strings!
- 🌳 Zero dependencies: Completely self contained!
- 💡 Inspired by Scala code style: Used by the best, now implemented for everyone.
yarn add multilines
import mls from 'multilines'
// Before
function generate(...args) {
const string = `
I have to start at the beggining of the line
so I don't break the string indentation.
`
}
// After
function generate(...args) {
const string = mls`
| I can be aligned with other code
| and everything still works as expected.
`
}
MIT @ Matic Zavadlal