js-trim-multiline-string
v1.0.8
Published
easy multiline syntax for javascript
Downloads
100
Maintainers
Readme
js-trim-multiline-string
multiline strings are a pain in javascript.
the most readable multiline string is as follows:
Expected Result:
"
this
is
a
multiline
string
"
Before:
def multilineStringExample() {
const stringConcatenation = '' +
'this ' +
'is' +
'a' +
'multiline' +
'string' +
'';
return stringConcatenation;
}
After:
def multilineStringExample() {
const taggedTemplate = mtrim `
this
is
a
multiline
string
`
return taggedTemplate
}
Install
$ npm install --save trim-multiline-string
FullUsage, (Use the library as a Function, Tagged Template, Prototype Function), If Indent present keep Indent.!
const { mtrim } = require('trim-multiline-string');
console.log(
mtrim(str),
mtrim(`str`),
mtrim`
check it out!
`,
mtrim
`check it out!`,
`str`.mtrim()
`
Keep Indent
Implementation
By Passing Number!
`.mtrim(3)
)
Related
multiline
- Multiline string using anonymous function, and function call.trim-newlines
- Similar toString#trim()
but removes only newlinestrim-right
- Similar toString#trim()
but removes only whitespace on the righttrim-off-newlines
- Similar toString#trim()
but removes only newlines
License
MIT © michael_dimmitt
Projects Using mtrim:
https://github.com/MichaelDimmitt/simp-js_term/blob/master/terminal.test.js