Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
naming-style
Advanced tools
One lightly library contains a series of methods for converting one string or text to different kind of naming style, such as camelCase, PascalCase, hyphen-case, CONSTANT_CASE, etc.
One lightly library contains a series of methods for converting one string or text to different kind of naming style, such as camelCase, PascalCase, hyphen-case, CONSTANT_CASE, etc.
yarn add naming-style
or
npm i naming-style
import {
style,
camel,
pascal,
hyphen,
constant,
snake,
underscore,
setence,
} from 'naming-style';
style('iAm24YearsOld'); // Detect naming style of 'iAm24YearsOld'
// Output: 'camel'
style('--naming-style -loves you'); // Detect naming style of '--naming-style -loves you'
// Output: 'other'
camel('--naming-style -loves you'); // Convert to camel case
// Output: 'namingStyleLovesYou'
pascal('--naming-style -loves you'); // Convert to pascal case
// Output: 'NamingStyleLovesYou'
hyphen('--naming-style -loves you'); // Convert to hyphen case
// Output: 'naming-style-loves-you'
constant('--naming-style -loves you'); // Convert to constant case
// Output: 'NAMING_STYLE_LOVES_YOU'
snake('--naming-style -loves you'); // Convert to snake case
// Output: 'naming_style_loves_you'
sentence('--naming-style -loves you'); // Convert to sentence case
// Output: 'Naming-style loves you'
underscore('--naming-style -loves you'); // Convert to underscore case
// Output: '__naming_style__loves_you'
This library provides 8 methods you can use:
style()
is used to detect the naming-style of the input.This library provides 7 naming styles you can convert to, including camel
, pascal
, hyphen
, constant
, snake
, sentence
and underscore
.
The first 6 styles are the basic styles, which the last one underscore
is derived from them.
Example:
camel --> 'iAm24YearsOld'
pascal --> 'IAm24YearsOld'
hyphen --> 'i-am-24-years-old'
constant --> 'I_AM_24_YEARS_OLD'
snake --> 'i_am_24_years_old'
sentence --> 'I am 24 years old'
underscore --> 'i_am_24_years_old'
Example:
import { style, camel, snake } from 'naming-style';
const origin = 'i_am_24_years_old';
const namingStyle = style(origin);
console.log(namingStyle);
// 'snake'
const camelCase = camel(origin);
const snake_case = snake(camelCase);
const newCamelCase = camel(snake_case);
console.log(camelCase === newCamelCase);
// true
style
method is 'other'
.Example:
import { style } from 'naming-style';
style('--naming-style -loves you');
// Output: 'other'
FAQs
One lightly library contains a series of methods for converting one string or text to different kind of naming style, such as camelCase, PascalCase, hyphen-case, CONSTANT_CASE, etc.
The npm package naming-style receives a total of 1,758 weekly downloads. As such, naming-style popularity was classified as popular.
We found that naming-style 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
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.