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.
pascal-case
Advanced tools
The pascal-case npm package is used to convert strings into PascalCase format, where the first letter of each word is capitalized and all words are concatenated without spaces. This is often used in programming to name classes, types, and other identifiers that require this specific casing convention.
Convert string to PascalCase
This feature takes a string and converts it to PascalCase. The given code sample demonstrates how you might manually convert a string to PascalCase by splitting it into words, capitalizing the first letter of each word, and then joining them together without spaces.
"hello world".split(' ').map(w => w.charAt(0).toUpperCase() + w.slice(1)).join('')
The camelcase package converts strings to camelCase. It is similar to pascal-case but the first letter of the result is in lowercase, which is the standard for naming variables and functions in many programming languages.
The change-case package is a more comprehensive string transformation library that includes pascalCase among many other case transformations. It provides a suite of utilities for various case conversions, making it more versatile than pascal-case if multiple case conversion functions are needed.
The uppercamelcase package is another alternative that converts strings to UpperCamelCase (or PascalCase). It is very similar to pascal-case but might have different handling of edge cases or additional options.
Transform into a string of capitalized words without separators.
npm install pascal-case --save
import { pascalCase } from "pascal-case";
pascalCase("string"); //=> "String"
pascalCase("dot.case"); //=> "DotCase"
pascalCase("PascalCase"); //=> "PascalCase"
pascalCase("version 1.2.10"); //=> "Version_1_2_10"
The function also accepts options
.
If you'd like to remove the behavior prefixing _
before numbers, you can use pascalCaseTransformMerge
:
import { pascalCaseTransformMerge } from "pascal-case";
pascalCase("version 12", { transform: pascalCaseTransformMerge }); //=> "Version12"
MIT
FAQs
Transform into a string of capitalized words without separators
The npm package pascal-case receives a total of 15,260,471 weekly downloads. As such, pascal-case popularity was classified as popular.
We found that pascal-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.