flat-camel

1.0.1 • Public • Published

node-flat-camel

camelCase object flattener

Flattens objects, arrays by converting it's keys into a camelCase format.

Installation

npm install flat-camel

How it works:

Object

const flattener = require('flat-camel');
 
const objectToFormat = {
  hello: {
    people: {
      how: {
        are: {
          you: 'good'
        }
      }
    }
  }
};
 
flattener.toCamelCase(objectToFormat);
 
// result
{
  helloPeopleHowAreYou: 'good'
};

Array

const flattener = require('flat-camel');
 
const arrayToFormat = [{
  hello: {
    people: {
      how: {
        are: {
          you: ['good']
        }
      }
    }
  }
}, 'hello', 1, true];
 
flattener.toCamelCase(arrayToFormat);
 
// result
[{
  helloPeopleHowAreYou: ['good']
}, 'hello', 1, true];

Tests

Requirements:

  • npm
  • make

Run make deps once and then make test to launch the test suite.

License

The MIT License MIT

Dependencies (1)

Dev Dependencies (7)

Package Sidebar

Install

npm i flat-camel

Weekly Downloads

0

Version

1.0.1

License

ISC

Last publish

Collaborators

  • dial-once
  • dvasylenko
  • jkernech
  • mrister
  • ky23