Socket
Socket
Sign inDemoInstall

camelize

Package Overview
Dependencies
0
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    camelize

recursively transform key strings to camel-case


Version published
Weekly downloads
4.6M
decreased by-19.28%
Maintainers
2
Install size
12.2 kB
Created
Weekly downloads
 

Package description

What is camelize?

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.

What are camelize's main functionalities?

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' })

Other packages similar to camelize

Readme

Source

camelize Version Badge

github actions coverage License Downloads

npm badge

recursively transform key strings to camel-case

example

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"
    }
  ]
}

methods

var camelize = require('camelize')

camelize(obj)

Convert the key strings in obj to camel-case recursively.

install

With npm do:

npm install camelize

To use in the browser, use browserify.

license

MIT

Keywords

FAQs

Last updated on 12 Oct 2022

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc