This package has been deprecated

Author message:

Please use @travelperksl/case-converter

case-converter

1.0.1 • Public • Published

case-converter npm version

A lightweight library that converts objects to different case conventions. Great for consuming APIs of services with different conventions, e.g. Python or Ruby.

Demo

Features

  • toCamelCase
  • toSnakeCase
  • toKebabCase

Install

npm install case-converter

Example:

  import { toCamelCase } from 'case-converter'
 
  const snakeCase = {
    an_object: {
      'kebab-case': 'nested content',
      nested_array: [{ an_object: 'something' }]
    },
    an_array: [
      { zero_index: 0 },
      { one_index: 1 }
    ]
  }
 
  const camelCase = toCamelCase(snakeCase);
 
  console.log(camelCase)
  /*
    {
      anObject: {
        kebabCase: 'nested content',
        nestedArray: [{ anObject: 'something' }]
      },
      anArray: [
        { zeroIndex: 0 },
        { oneIndex: 1 }
      ]
    }
  */

Package Sidebar

Install

npm i case-converter

Weekly Downloads

1,606

Version

1.0.1

License

MIT

Last publish

Collaborators

  • moezalez