sk

snakecase-keys

Convert an object's keys to snake case

Showing:

Popularity

Downloads/wk

213K

GitHub Stars

126

Maintenance

Last Commit

11d ago

Contributors

16

Package

Dependencies

3

License

MIT

Type Definitions

Built-In

Tree-Shakeable

No?

Categories

Readme

snakecase-keys tests

Convert an object's keys to snake case

Install

$ npm install --save snakecase-keys

Usage

var snakecaseKeys = require('snakecase-keys')

snakecaseKeys({fooBar: 'baz'})
//=> {foo_bar: 'baz'}

snakecaseKeys({'foo-bar': true, nested: {fooBaz: 'bar'}});
//=> {foo_bar: true, nested: {foo_baz: 'bar'}}

API

snakecaseKeys(obj, options) -> object

obj

Required
Type: object

An object to transform into snake case (keys only).

options

Optional
Type: object

deep

Type: boolean
Default: true

Enables snake-casing of keys in nested objects.

exclude

Type: array[string || regexp]
Default: []

An array of strings or regular expressions matching keys that will be excluded from snake-casing.

License

MIT © Ben Drucker

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial