Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Transform a string by swapping every character from upper to lower case, or lower to upper case
The swap-case npm package is designed to transform text by swapping the case of each character in a string. It converts lowercase letters to uppercase and vice versa, providing a simple and effective way to manipulate text case in JavaScript applications.
Swap Case
This feature allows you to swap the case of each character in a string. Lowercase letters become uppercase, and uppercase letters become lowercase. It's useful for text formatting and styling in applications.
const swapCase = require('swap-case');
let text = 'Hello World';
let swappedText = swapCase(text);
console.log(swappedText); // Outputs: 'hELLO wORLD'
The change-case package is a comprehensive text transformation library that includes various case conversion utilities such as camelCase, capitalCase, constantCase, dotCase, headerCase, noCase, paramCase, pascalCase, pathCase, sentenceCase, snakeCase, and swapCase. It offers more extensive functionality compared to swap-case, which focuses solely on swapping the case of characters.
The upper-case package is specifically designed to convert all characters in a string to uppercase. While it serves a different specific purpose, it is related in the broader category of case manipulation. Unlike swap-case, it does not provide the functionality to swap cases but rather converts all characters to a single case.
Similar to upper-case, the lower-case package converts all characters in a string to lowercase. It is another example of a case manipulation package but, like upper-case, does not offer the swapping functionality found in swap-case.
Transform a string by swapping every character from upper to lower case, or lower to upper case.
npm install swap-case --save
import { swapCase } from "swap-case";
swapCase("string"); //=> "STRING"
swapCase("dot.case"); //=> "DOT.CASE"
swapCase("PascalCase"); //=> "pASCALcASE"
This package is a pure ESM package and ships with TypeScript definitions. It cannot be require
'd or used with CommonJS module resolution in TypeScript.
MIT
FAQs
Transform a string by swapping every character from upper to lower case, or lower to upper case
The npm package swap-case receives a total of 4,653,306 weekly downloads. As such, swap-case popularity was classified as popular.
We found that swap-case demonstrated a healthy version release cadence and project activity because the last version was released less than 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
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.