Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
babel-dedentor
Advanced tools
[babel-plugin-dedent](https://github.com/MartinKolarik/babel-plugin-dedent) with more configuration.
babel-plugin-dedent with more configuration.
yarn add --save-dev babel-dedentor
In your babel.config.json
:
{
"plugins": [
[
"babel-dedentor",
{
// Showing default configuration, all of the following fields are optional
"tagName": "dedent",
// Retain the function call, useful for dedenting SQL statements and `chalk` strings.
"keepFunctionCall": false,
"trimLeft": true,
"trimRight": true
}
]
]
}
Prefer type safe Babel configuration? Try the following:
import { useDedentPlugin } from "babel-dedentor"
export default {
plugins: [
useDedentPlugin(["dedent", "html"]),
useDedentPlugin({
// `name` is needed if you use the plugin twice, the value doesn’t matter
name: "dedent2",
tagName: "dedent",
keepFunctionCall: false,
trimLeft: true,
trimRight: true,
}),
],
}
Indentation will be removed from all strings tagged with dedent
tag (or any tag specified in your configuration).
expect(dedent`Line #1
Line #2
Line #3`).to.equal("Line #1\nLine #2\nLine #3")
// Leading/trailing line break is removed.
expect(
dedent`
Line #1
Line #2
Line #3
`
).to.equal("Line #1\nLine #2\nLine #3")
// No more than one leading/trailing line break is removed.
expect(
dedent`
Line #1
Line #2
Line #3
`
).to.equal("\nLine #1\nLine #2\nLine #3\n")
// Only the "base" indentation is removed.
expect(
dedent`
Line #1
Line #2
Line #3
`
).to.equal("Line #1\n\tLine #2\n\t\tLine #3")
// The last line is ignored if it doesn't contain anything else than whitespace.
expect(
(function () {
return dedent`
Line #1
Line #2
Line #3
`
})()
).to.equal("Line #1\nLine #2\nLine #3")
// Escaped characters are ignored.
expect(
dedent`
\tLine #1
\tLine #2
\tLine #3
`
).to.equal("\tLine #1\n\tLine #2\n\tLine #3")
Copyright (c) 2020 ~proteria.
Copyright (c) 2015 - 2020 Martin Kolárik.
Released under the MIT license.
FAQs
[babel-plugin-dedent](https://github.com/MartinKolarik/babel-plugin-dedent) with more configuration.
The npm package babel-dedentor receives a total of 1 weekly downloads. As such, babel-dedentor popularity was classified as not popular.
We found that babel-dedentor 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
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.