0.5.0 • Published 9 years ago

recase-keys v0.5.0

Weekly downloads
5
License
MIT
Repository
github
Last release
9 years ago

Introduction

Simple functions that recursively change the case of keys in plain objects. Practical when exposing camel-case names in an API with a snake-cased database backend. This module builds on the excellent Case to perform the actual case conversion. So any conversion supported by Case is supported by recase-keys.

Installation

$ npm install recase-keys

Usage

var recase = require('recase-keys')

console.log(
	recase.toCamel({
		hello_world: ['hello_world','FOO_BAR'],
		foo_bar: [{tic_tac_toe: 9}]
	})
)

// Outputs 
// {
// 	helloWorld: ['hello_world', 'FOO_BAR'],
//	fooBar: [{ticTacToe:9}]
// }