tanem / snakecase-keys

Convert an object's keys to snake case

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

snakecase-keys Build Status

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) -> object

obj

Required
Type: object

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

License

MIT © Ben Drucker

About

Convert an object's keys to snake case

License:MIT License


Languages

Language:JavaScript 100.0%