Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
babel-dedentor
Advanced tools
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({
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 0 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.