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.
lodash.snakecase
Advanced tools
The lodash.snakecase npm package is a utility function that converts a given string to snake_case, where each word is lowercased and separated by an underscore character. It is part of the Lodash library, which is a popular JavaScript utility library for working with arrays, numbers, objects, strings, etc.
String Conversion to snake_case
Converts a string with spaces, camelCase, or PascalCase to snake_case.
_.snakeCase('Foo Bar'); // => 'foo_bar'
Handling Special Characters
Converts a string with dashes or other non-alphanumeric characters to snake_case, removing the special characters.
_.snakeCase('foo-bar'); // => 'foo_bar'
Accommodating Mixed Cases and Numbers
Handles strings with a mix of cases and numbers, ensuring numbers are preserved in the conversion.
_.snakeCase('fooBar2023'); // => 'foo_bar2023'
This package provides similar functionality to lodash.snakecase by converting a string to snake_case. It is a smaller, more focused package if you only need snake case conversion without the additional utility functions provided by Lodash.
change-case is a more comprehensive string transformation library that includes snake case conversion among many other case transformations. It offers a broader set of string manipulation utilities compared to lodash.snakecase.
The 'case' package is another alternative that supports various case transformations, including snake case. It is similar to change-case and can be used if you need a variety of string case conversions.
The lodash method _.snakeCase
exported as a Node.js module.
Using npm:
$ {sudo -H} npm i -g npm
$ npm i --save lodash.snakecase
In Node.js:
var snakeCase = require('lodash.snakecase');
See the documentation or package source for more details.
FAQs
The lodash method `_.snakeCase` exported as a module.
The npm package lodash.snakecase receives a total of 5,147,225 weekly downloads. As such, lodash.snakecase popularity was classified as popular.
We found that lodash.snakecase demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers 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.