Skip to content
/ camelize Public
forked from Raynos/camelize

recursively transform key strings to camel-case

Notifications You must be signed in to change notification settings

ash14/camelize

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Camelize

Recursively transform JSON object-keys to camelCase

Example

var camelize = require('camelize');
var obj = {
    basic_case: 'camelized',
    _leading_underscores: 'are preserved',
    'other.types.of.keys': 'are ok',
    'other-types-of-keys': 'are ok',
    LowerCaseCameling: 'whatever that’s called',
    NESTED_ARRAYS: [
        { weirderKEYS: 'foo' },
        { WAT: 'bar' },
        { ALLSortsOfThings: 'baz' }
    ]
}

var res = camelize(obj);
/*
res = {
    basicCase: 'camelized',
    _leadingUnderscores: 'are preserved',
    otherTypesOfKeys: 'are ok',
    otherTypesOfKeys: 'are ok',
    lowerCaseCameling: 'whatever that’s called',
    nestedArrays: [
        { weirderKeys: 'foo' },
        { wat: 'bar' },
        { allSortsOfThings: 'baz' }
    ]
}
*/

Based on substack/camelize

About

recursively transform key strings to camel-case

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%