
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
The camelize npm package is designed to convert strings (including object keys) from various formats like snake_case, kebab-case, etc., into camelCase. This is particularly useful in JavaScript programming where camelCase is a common convention for naming variables and object keys.
Camelizing strings
Converts a kebab-case or any other non-camelCase string into camelCase. For example, 'my-example-string' would be converted to 'myExampleString'.
"my-example-string".camelize()
Camelizing object keys
Converts all keys in an object from other formats into camelCase. For example, an object with keys 'my-key' and 'another_key' would have its keys converted to 'myKey' and 'anotherKey', respectively.
camelize({ 'my-key': true, 'another_key': 'value' })
Similar to camelize, humps is designed to convert strings and object keys between camelCase and snake_case. It offers more comprehensive options for decamelizing and camelize keys recursively in nested objects, which might make it a more versatile choice for some projects.
Change-case is a more comprehensive string manipulation library that includes functions for transforming strings into various cases, including camel case. It offers a wider range of case transformations compared to camelize, making it suitable for projects that require more than just camelization.
recursively transform key strings to camel-case
var camelize = require('camelize');
var obj = {
fee_fie_foe: 'fum',
beep_boop: [
{ 'abc.xyz': 'mno' },
{ 'foo-bar': 'baz' }
]
};
var res = camelize(obj);
console.log(JSON.stringify(res, null, 2));
output:
{
"feeFieFoe": "fum",
"beepBoop": [
{
"abcXyz": "mno"
},
{
"fooBar": "baz"
}
]
}
var camelize = require('camelize')
Convert the key strings in obj
to camel-case recursively.
With npm do:
npm install camelize
To use in the browser, use browserify.
MIT
FAQs
recursively transform key strings to camel-case
The npm package camelize receives a total of 5,957,483 weekly downloads. As such, camelize popularity was classified as popular.
We found that camelize demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.