0.0.3 • Published 6 years ago

chameleon-case v0.0.3

Weekly downloads
-
License
MIT
Repository
-
Last release
6 years ago

Object key Changer that you can pick some classes which should be ignored from key changing. For example, you can customize it for ignoring 'Date' and 'ObjectID' for mongoose object

Usage

var cc = require('chameleon-case');
cc.camelcase({ hello_world: { hello_world: [ { hello_world: 1 } ] } });
// {helloWorld: {helloWorld: [{helloWorld: 1}]}} 

cc.snakecase({ helloWorld: { helloWorld: [ { helloWorld: 1 } ] } } );
// {hello_world: {hello_world: [{hello_world: 1}]}} 


/* with Mongoose */
cc.option({
    ignoreClass: ['Date', 'ObjectID'] // Date is for some timestamps. ObjectID is for sub document id
  })
MyObject.findOne().lean().then(doc => cc.camelcase(doc)) // Note that you should call lean for avoiding infinite loop
0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago