
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
The de-indent npm package is a utility for removing leading indentation from multiline strings. This can be particularly useful when dealing with template literals in JavaScript, where you want to maintain readability in your code without preserving the indentation in the resulting string.
Basic De-indentation
This feature removes the leading indentation from a multiline string, making it easier to work with template literals without preserving the indentation in the final string.
const deindent = require('de-indent');
const indentedString = `
function example() {
console.log('Hello, world!');
}
`;
const result = deindent(indentedString);
console.log(result);
De-indentation with Template Literals
This feature is useful for de-indenting HTML or XML strings defined using template literals, making the code more readable while ensuring the final string has no leading spaces.
const deindent = require('de-indent');
const indentedString = `
<div>
<p>Hello, world!</p>
</div>
`;
const result = deindent(indentedString);
console.log(result);
The strip-indent package is another utility for removing leading whitespace from multiline strings. It works similarly to de-indent but offers a slightly different API. Both packages achieve the same goal, but developers might prefer one over the other based on personal preference or specific use cases.
The dedent package is a popular alternative that not only removes leading indentation but also handles escaping of backticks and interpolation of variables within template literals. It offers more features compared to de-indent, making it a more versatile choice for complex string manipulations.
FAQs
remove extra indent from a block of code
The npm package de-indent receives a total of 3,851,387 weekly downloads. As such, de-indent popularity was classified as popular.
We found that de-indent 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.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.