{
  "name": "tablify",
  "description": "Quick and painless printing of tabular data",
  "version": "0.1.5",
  "directories": {
    "lib": "./lib"
  },
  "main": "lib/tablify.js",
  "author": {
    "name": "Chris Coyne",
    "email": "ccoyne77@gmail.com"
  },
  "devDependencies": {
    "coffee-script": "*"
  },
  "repository": {
    "type": "git",
    "url": "http://github.com/malgorithms/tablify"
  },
  "licenses": [
    {
      "type": "MIT",
      "url": "http://github.com/malgorithms/tablify/raw/master/LICENSE"
    }
  ],
  "keywords": [
    "table",
    "ascii",
    "ansii",
    "cli",
    "terminal",
    "console"
  ],
  "readme": "tablify\n=======\n\nIn NodeJs programs, printing structured arrays to the console can be annoying. `tablify` fulfills your greatest desires.\n\nIt can generate a pretty table out of\n - an array of arrays\n - an array of dictionaries; this is perhaps the most common thanks to (no)SQL\n - a single dictionary, with each key/value pair getting a nice row\n - data with or without headers\n\nFor example, here's how tablify handles an array of arrays:\n\n``` js\n\ntablify = require('tablify').tablify\ndata = [\n  [1,2,3]\n  [\"cat\",\"dog\",Math.PI]\n]\nconsole.log tablify data\n\n```\n\nOutput:\n\n```\n---------------------------------\n| 1   | 2   | 3                 |\n| cat | dog | 3.141592653589793 |\n---------------------------------\n```\n\n### Showing headers\n\nIf your structure has a header row, pass the optional \"has_header\" param:\n\n``` js\ndata = [\n  [\"name\",\"age\"]\n  [\"Chris\",10] \n  [\"Max\",8]\n]\nconsole.log tablify data, {has_header: true}\n```\n\nOutput:\n\n```\n---------------\n| name  | age |\n---------------\n| Chris | 10  |\n| Max   | 8   |\n---------------\n```\n\n### Even cooler: an array of dictionaries\n\nEven with inconsistent keys, you can print an array of dictionaries. Column headers are calculated automatically using the union of all keys.\n\n``` js\ndata = [\n  {name: \"Chris\", age: 16, gender: \"M\"} \n  {name: \"Max\",   age: 12, gender: \"M\"}\n  {name: \"Sam\",            gender: \"F\", colors: [\"Orange\", \"Blue\"]}\n]\nconsole.log tablify data\n```\n\nOutput:\n\n```\n-------------------------------------------------\n| # | age  | colors            | gender | name  |\n-------------------------------------------------\n| 0 | 16   |                   | M      | Chris |\n| 1 | 12   |                   | M      | Max   |\n| 2 |      | [\"Orange\",\"Blue\"] | F      | Sam   |\n-------------------------------------------------\n```\n\n### Selecting only specific keys:\n\n```\nconsole.log tablify data, {keys: [\"age\",\"name\"]}\n```\n\nOutput:\n\n```\n--------------------\n| # | age  | name  |\n--------------------\n| 0 | 16   | Chris |\n| 1 | 12   | Max   |\n| 2 |      | Sam   |\n--------------------\n```\n\n### A single dictionary:\n\nIf tablify is passed an object that's not an array, it will pivot to show keys in one column and values in another.\n\n```\nconsole.log tablify {\"name\": \"Chris\", \"age\": 25, \"obj\": [1,2,3,{\"foo\":\"bar\"}]}\n```\n\nOutput:\n\n```\n--------------------------------\n| age  | 25                    |\n| name | Chris                 |\n| obj  | [1,2,3,{\"foo\":\"bar\"}] |\n--------------------------------\n```\n\n# List of Options \n\nAny subset of these can be passed as a second parameter to tablify, in a dictionary.\n\n  - `show_index`   include a column showing the row number of each row. The default is `false` unless tablify is passed an array of dictionaries, in which case the default is `true`\n  - `has_header`   include the first row as a header; this defaults to `false` unless passed an array of dicts, in which case the keys are used as a first row and this defaults to `true`; if passing a single dictionary, this is ignored\n  - `keys`         which columns to use, when tablifying an array of dictionaries; by default all keys are used in alphabetical order\n  - `row_start`    default = '| '\n  - `row_end`      default = ' |'\n  - `spacer`       default = ' | '\n  - `row_sep_char` default = '-'\n\n\n\n# Installation\n\n```\n> npm install -g tablify\n```\n",
  "readmeFilename": "README.md",
  "bugs": {
    "url": "https://github.com/malgorithms/tablify/issues"
  },
  "homepage": "https://github.com/malgorithms/tablify",
  "_id": "tablify@0.1.5",
  "_from": "tablify@0.1.5"
}
