node package manager

expand-object-keys

expand-object-keys Build Status

Expand dotty object keys to objects

Install

$ npm install --save expand-object-keys

Usage

import expandObjectKeys from 'expand-object-keys';
 
 
const obj = {
  'profile.name': 'myname',
  'profile.email': 'myname@gmail.com',
  'profile.address.street': 'Home address',
  'profile.address.zip': '1234',
  mac: 'some mac',
  dist: 'fedora 22'
};
 
const newObj = expandObjectKeys(obj);
 
console.log(newObj); // => 
                     // { 
                     //   profile: { 
                     //     name: 'myname', 
                     //     email: 'myname@gmail.com', 
                     //     address: { 
                     //       street: 'Home address', 
                     //       zip: '1234' 
                     //     }, 
                     //   }, 
                     //   mac: 'some mac', 
                     //   dist: 'fedora 22' 
                     // }; 

License

MIT © Stoeffel