@leothesen/change-case

1.3.0 • Public • Published

change-case

Recursive functions for changing the case of object fields. Best

Install

npm install @leothesen/change-case

Usage

const { 
  toCamelCase,
  toSnakeCase
} = require('@leothesen/change-case');

const snake_case = {
  mixed_array_field: [
    'text',
    {
      plain_field: 'text',
      mixed_object_field: {
        numeric_field: 42,
        arrary_field: [
          42,
          'fourty two',
          { fourty_two: 42 }
        ]
      }
    }
  ]
};

const camelCase = toCamelCase(snake_case);
/**
 * camelCase = {
 *  plainField: 'text',
 *  mixedObjectField: {
 *    numericField: 42,
 *    arrayField: [
 *      42,
 *      'fourty two',
 *      { fourtyTwo: 42}
 *    ]
 *  }
 * }
 */

License

MIT

Dependencies (1)

Dev Dependencies (4)

Package Sidebar

Install

npm i @leothesen/change-case

Weekly Downloads

0

Version

1.3.0

License

MIT

Unpacked Size

6.07 kB

Total Files

13

Last publish

Collaborators

  • leothesen