🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

humps

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

humps

Underscore-to-camelCase converter (and vice versa) for strings and object keys in JavaScript.

2.0.1
latest
Source
npm
Version published
Weekly downloads
756K
3.43%
Maintainers
1
Weekly downloads
 
Created

What is humps?

The 'humps' npm package is a utility library for converting object keys between different naming conventions, such as camelCase, snake_case, and kebab-case. It is particularly useful for working with APIs that use different naming conventions than your JavaScript code.

What are humps's main functionalities?

camelizeKeys

Converts the keys of an object from snake_case to camelCase.

const humps = require('humps');
const input = { first_name: 'John', last_name: 'Doe' };
const output = humps.camelizeKeys(input);
console.log(output); // { firstName: 'John', lastName: 'Doe' }

decamelizeKeys

Converts the keys of an object from camelCase to snake_case.

const humps = require('humps');
const input = { firstName: 'John', lastName: 'Doe' };
const output = humps.decamelizeKeys(input);
console.log(output); // { first_name: 'John', last_name: 'Doe' }

kebabizeKeys

Converts the keys of an object from camelCase to kebab-case.

const humps = require('humps');
const input = { firstName: 'John', lastName: 'Doe' };
const output = humps.kebabizeKeys(input);
console.log(output); // { 'first-name': 'John', 'last-name': 'Doe' }

pascalizeKeys

Converts the keys of an object from snake_case to PascalCase.

const humps = require('humps');
const input = { first_name: 'John', last_name: 'Doe' };
const output = humps.pascalizeKeys(input);
console.log(output); // { FirstName: 'John', LastName: 'Doe' }

Other packages similar to humps

Keywords

utils

FAQs

Package last updated on 18 Jun 2017

Did you know?

Socket

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