Skip to content

Simple functions that recursively change the case of keys in plain objects.

Notifications You must be signed in to change notification settings

macprog-guy/recase-keys

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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}]
// }

About

Simple functions that recursively change the case of keys in plain objects.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published