Security News
JavaScript Leaders Demand Oracle Release the JavaScript Trademark
In an open letter, JavaScript community leaders urge Oracle to give up the JavaScript trademark, arguing that it has been effectively abandoned through nonuse.
@types/humps
Advanced tools
TypeScript definitions for humps
@types/humps is a TypeScript type definition package for the humps library, which provides utilities for converting object keys between camelCase, snake_case, and other formats. This is particularly useful for working with APIs that use different naming conventions.
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' }
camelize
Converts a string from snake_case to camelCase.
const humps = require('humps');
const input = 'hello_world';
const output = humps.camelize(input);
console.log(output); // 'helloWorld'
decamelize
Converts a string from camelCase to snake_case.
const humps = require('humps');
const input = 'helloWorld';
const output = humps.decamelize(input);
console.log(output); // 'hello_world'
Lodash is a popular utility library that provides a wide range of functions for manipulating arrays, objects, and other data types. It includes methods like _.camelCase and _.snakeCase for converting strings between different cases. However, it is a much larger library with a broader scope compared to humps.
The change-case package provides a collection of functions for changing the case of strings, such as camelCase, snake_case, and others. It is more focused on string manipulation and does not provide utilities for converting object keys like humps does.
case-converter is a lightweight library specifically designed for converting object keys between different cases, similar to humps. It offers similar functionality but may have a different API and fewer features compared to humps.
npm install --save @types/humps
This package contains type definitions for humps (https://github.com/domchristie/humps).
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/humps.
These definitions were written by Niklas Mollenhauer, and Piotr Błażejewicz.
FAQs
TypeScript definitions for humps
The npm package @types/humps receives a total of 101,758 weekly downloads. As such, @types/humps popularity was classified as popular.
We found that @types/humps demonstrated a healthy version release cadence and project activity because the last version was released less than 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.
Security News
In an open letter, JavaScript community leaders urge Oracle to give up the JavaScript trademark, arguing that it has been effectively abandoned through nonuse.
Security News
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.