convert-keys

Convert object keys to camelCase or snakeCase.

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
convert-keys
1.3.45 years ago7 years agoMinified + gzip package size for convert-keys in KB

Readme

convert-keys
Build Status codecov npm version
Install
$ npm install convert-keys
Usage
const convertKeys = require('convert-keys');

const obj = {
  'hoge_fuga': 1,
  hogeHoge: {
    'piyo_piyo': 'aaaa',
    'fuga_fuga': 'bbbb'
  }
};

convertKeys.toCamel(obj);

// output
{
  hogeFuga: 1,
  hogeHoge: {
    piyoPiyo: 'aaaa',
    fugaFuga: 'bbbb'
  }
}

convertKeys.toSnake(obj);

// output
{
  'hoge_fuga': 1,
  'hoge_hoge': {
    'piyo_piyo': 'aaaa',
    'fuga_fuga': 'bbbb'
  }
}