Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
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.

  • 0.6.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
569K
decreased by-6.35%
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

FAQs

Package last updated on 14 Jun 2015

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc