g-format

0.0.7 • Public • Published

format object keys

currently implemented:

  • convert underscore key to camelCase key
  • convert camelCase key to undercore key

Usage

Case 1

Convert data from orm to JavaScript naming convention

const { getCamelCase, getUndersocre } = require('g-format');

let person_from_orm = {
  'id': 1,
  'my_name': 'siria',
  'my_real_name': 'dog',
};
let person = getCamelCase(person_from_orm);

Case 2

Convert date from JavaScript naming convention to ORM

let personOfJS = {
  'id': 1,
  'myName': 'siria',
  'myRealName': 'dog',
}
let personOfORM = getUndersocre(personOfJs);
someORM.insert('people', personOfORM);

Package Sidebar

Install

npm i g-format

Weekly Downloads

7

Version

0.0.7

License

MIT

Unpacked Size

6.22 kB

Total Files

6

Last publish

Collaborators

  • siria55