Big update!Introducing GitHub Bot Commands. Learn more
Socket
Log inDemoInstall

decamelize-keys

Package Overview
Dependencies
4
Maintainers
1
Versions
5
Issues
File Explorer

Advanced tools

decamelize-keys

Convert object keys from camel case

    2.0.1latest
    Github

Version published
Maintainers
1
Weekly downloads
9,753,495
increased by8.76%

Weekly downloads

Readme

Source

decamelize-keys

Convert object keys from camel case using decamelize

Install

npm install decamelize-keys

Usage

import decamelizeKeys from 'decamelize-keys'; // Convert an object decamelizeKeys({fooBar: true}); //=> {foo_bar: true} // Convert an array of objects decamelizeKeys([{fooBar: true}, {barFoo: false}]); //=> [{foo_bar: true}, {bar_foo: false}]

API

decamelizeKeys(input, options?)

input

Type: object | object[]

An object or array of objects to decamelize.

options

Type: object

separator

Type: string
Default: '_'

The character or string used to separate words.

import decamelizeKeys from 'decamelize-keys'; decamelizeKeys({fooBar: true}); //=> {foo_bar: true} decamelizeKeys({fooBar: true}, {separator: '-'}); //=> {'foo-bar': true}
exclude

Type: Array<string | RegExp>
Default: []

Exclude keys from being decamelized.

deep

Type: boolean
Default: false

Recurse nested objects and objects in arrays.

import decamelizeKeys from 'decamelize-keys'; decamelizeKeys({fooBar: true, nested: {unicornRainbow: true}}, {deep: true}); //=> {foo_bar: true, nested: {unicorn_rainbow: true}}
  • camelcase-keys - The inverse of this package.

Keywords

FAQs

What is decamelize-keys?

Convert object keys from camel case

Is decamelize-keys popular?

The npm package decamelize-keys receives a total of 9,370,200 weekly downloads. As such, decamelize-keys popularity was classified as popular.

Is decamelize-keys well maintained?

We found that decamelize-keys 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.

Last updated on 30 Oct 2022

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket[email protected]

Product

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc