
Security News
ESLint Adds Official Support for Linting HTML
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.
trim-margin
Advanced tools
trimMargin
like Kotlin and stripMargin
like Scala.
trimMargin
or stripMargin
.$ npm i -S trim-margin
const {
trimMargin,
tm,
inject,
} = require("trim-margin");
console.log(trimMargin(`
|trim
| indent
| spaces`));
// => "\ntrim\n indent\n spaces"
console.log(trimMargin(`
#other
# delimiter`, "#"));
// => "\nother\n delimiter"
const template = ` | template`;
const literal = ` | literal`;
console.log(tm`\
|tagged
${template}
|${literal}`);
// => "tagged\n template\n | literal"
inject();
console.log(`\
|inject
to | string`.trimMargin());
// => "inject\n to | string"
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/
Indented string.
Indent delimiter.
This is used as an argument to a RegExp
object.
defalut: "\\|"
Same trimMargin
.
Use as Tagged template literals.
Same trimMargin(literal)
.
Same tm
.
Inject to String
: trimMargin
and stripMargin
.
You can use it like method of string type.
Inject to String
: trimMargin
.
You can use it like method of string type.
Inject to String
: stripMargin
.
You can use it like method of string type.
Inject to String
.
You can use it like method of string type.
Method name injected into string type.
MIT © tee-talog
FAQs
"trimMargin" like Kotlin and "stripMargin" like Scala.
The npm package trim-margin receives a total of 3,770 weekly downloads. As such, trim-margin popularity was classified as popular.
We found that trim-margin demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.
Security News
CISA is discontinuing official RSS support for KEV and cybersecurity alerts, shifting updates to email and social media, disrupting automation workflows.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.