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.
snake-case
Advanced tools
The snake-case npm package is designed to convert strings into snake case format, where each word is lowercased and separated by underscores. This is particularly useful for formatting identifiers in programming languages that favor snake case conventions, such as Python and Ruby, or for generating keys for data formats like JSON that may require consistent naming conventions.
Convert string to snake case
This feature allows you to convert any string into snake case, making it lowercased and separating words with underscores. It's useful for formatting strings to meet certain coding standards or data formats.
"Hello World".toSnakeCase(); // 'hello_world'
Custom locale support
The package supports custom locales, enabling the conversion of strings with locale-specific characters into snake case while preserving those characters appropriately.
"Äpfel und Birnen".toSnakeCase({ locale: 'de' }); // 'äpfel_und_birnen'
Lodash is a comprehensive utility library that includes a `_.snakeCase` function among its string manipulation methods. Compared to snake-case, lodash offers a broader range of functionalities beyond string conversion, making it a more versatile choice for projects requiring multiple utility functions.
Change-case is a collection of utilities to convert strings between various cases. It includes a `snakeCase` function similar to what snake-case offers. The main difference is that change-case provides a wider array of case conversion options, such as camel case, pascal case, and more, making it suitable for projects that need to handle multiple string case formats.
Transform into a lower case string with underscores between words.
npm install snake-case --save
import { snakeCase } from "snake-case";
snakeCase("string"); //=> "string"
snakeCase("dot.case"); //=> "dot_case"
snakeCase("PascalCase"); //=> "pascal_case"
snakeCase("version 1.2.10"); //=> "version_1_2_10"
The function also accepts options
.
MIT
FAQs
Transform into a lower case string with underscores between words
The npm package snake-case receives a total of 10,474,781 weekly downloads. As such, snake-case popularity was classified as popular.
We found that snake-case 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.