Skip to content

Generate a table-friendly object by flattening and normalizing the keys

Notifications You must be signed in to change notification settings

trevorgerhardt/tableize

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tableize

Generate a table-friendly object by flattening and normalizing the keys.

Installation

$ npm install tableize

Example

var tableize = require('tableize');

var obj = tableize({
  user: {
    id: 123242123,

    name: {
      first: 'tobi',
      last: 'loki'
    },

    properties: {
      category: 'Buttons',
      label: 'Login'
    },

    context: {
      userAgent: 'Mozilla whatever'
    }
  }
});

console.log(obj);

yields:

{ 'user.id': 123242123,
  'name.first': 'tobi',
  'name.last': 'loki',
  'properties.category': 'Buttons',
  'properties.label': 'Login',
  'context.userAgent': 'Mozilla whatever' }

License

MIT

About

Generate a table-friendly object by flattening and normalizing the keys

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 96.7%
  • Makefile 3.3%