"trimMargin" like Kotlin and "stripMargin" like Scala.
npm install trim-margintrimMargin like Kotlin and stripMargin like Scala.

trimMargin or stripMargin.
$ npm i -S trim-margin
`Usage
`js
const {
trimMargin,
tm,
inject,
} = require("trim-margin");console.log(trimMargin(
));
// => "\ntrim\n indent\n spaces"console.log(trimMargin(
, "#"));
// => "\nother\n delimiter"const template =
| template;
const literal = | literal;
console.log(tm\);
// => "tagged\n template\n | literal"inject();
console.log(
\.trimMargin());
// => "inject\n to | string"
`API
$3
Trim indent spaces.
More detail "spaces":
> Matches a single character other than white space. Equivalent to
[^ \f\n\r\t\v\u00a0\u1680\u180e\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff].From: MDN web docs
Expect,
/\r?\n/#### str: string
Indented string.
#### delimiter: string
Indent delimiter.
This is used as an argument to a
RegExp object.
defalut: "\\|"$3
Same
trimMargin.$3
Use as Tagged template literals.
Same
trimMargin(literal).$3
Same
tm.$3
Inject to
String: trimMargin and stripMargin.
You can use it like method of string type.$3
Inject to
String: trimMargin.
You can use it like method of string type.$3
Inject to
String: stripMargin.
You can use it like method of string type.$3
Inject to
String`.#### methodName: string
Method name injected into string type.