{
  "_args": [
    [
      {
        "raw": "table@^4.0.1",
        "scope": null,
        "escapedName": "table",
        "name": "table",
        "rawSpec": "^4.0.1",
        "spec": ">=4.0.1 <5.0.0",
        "type": "range"
      },
      "/home/travis/build/lukesargeant/ember-sparkline/node_modules/eslint"
    ]
  ],
  "_from": "table@>=4.0.1 <5.0.0",
  "_id": "table@4.0.2",
  "_inCache": true,
  "_location": "/table",
  "_nodeVersion": "8.5.0",
  "_npmOperationalInternal": {
    "host": "s3://npm-registry-packages",
    "tmp": "tmp/table-4.0.2.tgz_1506446352168_0.7946070395410061"
  },
  "_npmUser": {
    "name": "gajus",
    "email": "gajus@gajus.com"
  },
  "_npmVersion": "5.3.0",
  "_phantomChildren": {
    "color-convert": "1.9.1",
    "escape-string-regexp": "1.0.5",
    "has-flag": "2.0.0"
  },
  "_requested": {
    "raw": "table@^4.0.1",
    "scope": null,
    "escapedName": "table",
    "name": "table",
    "rawSpec": "^4.0.1",
    "spec": ">=4.0.1 <5.0.0",
    "type": "range"
  },
  "_requiredBy": [
    "/eslint"
  ],
  "_resolved": "https://registry.npmjs.org/table/-/table-4.0.2.tgz",
  "_shasum": "a33447375391e766ad34d3486e6e2aedc84d2e36",
  "_shrinkwrap": null,
  "_spec": "table@^4.0.1",
  "_where": "/home/travis/build/lukesargeant/ember-sparkline/node_modules/eslint",
  "author": {
    "name": "Gajus Kuizinas",
    "email": "gajus@gajus.com",
    "url": "http://gajus.com"
  },
  "bugs": {
    "url": "https://github.com/gajus/table/issues"
  },
  "dependencies": {
    "ajv": "^5.2.3",
    "ajv-keywords": "^2.1.0",
    "chalk": "^2.1.0",
    "lodash": "^4.17.4",
    "slice-ansi": "1.0.0",
    "string-width": "^2.1.1"
  },
  "description": "Formats data into a string table.",
  "devDependencies": {
    "ajv-cli": "^2.1.0",
    "babel": "^6.23.0",
    "babel-cli": "^6.26.0",
    "babel-core": "^6.26.0",
    "babel-plugin-istanbul": "^4.1.5",
    "babel-preset-es2015-node4": "^2.1.1",
    "babel-register": "^6.26.0",
    "chai": "^4.1.2",
    "eslint": "^4.7.2",
    "eslint-config-canonical": "^9.3.1",
    "gitdown": "^2.5.1",
    "husky": "^0.14.3",
    "mocha": "^3.5.3",
    "nyc": "^11.2.1",
    "sinon": "^4.0.0"
  },
  "directories": {},
  "dist": {
    "integrity": "sha512-UUkEAPdSGxtRpiV9ozJ5cMTtYiqz7Ni1OGqLXRCynrvzdtR1p+cfOWe2RJLwvUG8hNanaSRjecIqwOjqeatDsA==",
    "shasum": "a33447375391e766ad34d3486e6e2aedc84d2e36",
    "tarball": "https://registry.npmjs.org/table/-/table-4.0.2.tgz"
  },
  "gitHead": "badda76001555c06cbcd688b17a359de7b0c29f5",
  "homepage": "https://github.com/gajus/table#readme",
  "keywords": [
    "ascii",
    "text",
    "table",
    "align",
    "ansi"
  ],
  "license": "BSD-3-Clause",
  "main": "./dist/index.js",
  "maintainers": [
    {
      "name": "gajus",
      "email": "gajus@gajus.com"
    }
  ],
  "name": "table",
  "nyc": {
    "include": [
      "src/*.js"
    ],
    "instrument": false,
    "lines": 70,
    "require": [
      "babel-register"
    ],
    "sourceMap": false
  },
  "optionalDependencies": {},
  "readme": "<a name=\"table\"></a>\n# Table\n\n[![Travis build status](http://img.shields.io/travis/gajus/table/master.svg?style=flat)](https://travis-ci.org/gajus/table)\n[![NPM version](http://img.shields.io/npm/v/table.svg?style=flat)](https://www.npmjs.com/package/table)\n[![js-canonical-style](https://img.shields.io/badge/code%20style-canonical-brightgreen.svg?style=flat)](https://github.com/gajus/canonical)\n\n* [Table](#table)\n    * [Features](#table-features)\n    * [Usage](#table-usage)\n        * [Cell Content Alignment](#table-usage-cell-content-alignment)\n        * [Column Width](#table-usage-column-width)\n        * [Custom Border](#table-usage-custom-border)\n        * [Draw Horizontal Line](#table-usage-draw-horizontal-line)\n        * [Padding Cell Content](#table-usage-padding-cell-content)\n        * [Predefined Border Templates](#table-usage-predefined-border-templates)\n        * [Streaming](#table-usage-streaming)\n        * [Text Truncation](#table-usage-text-truncation)\n        * [Text Wrapping](#table-usage-text-wrapping)\n\n\nProduces a string that represents array data in a text table.\n\n![Demo of table displaying a list of missions to the Moon.](./.README/demo.png)\n\n<a name=\"table-features\"></a>\n## Features\n\n* Works with strings containing [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) characters.\n* Works with strings containing [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code).\n* Configurable border characters.\n* Configurable content alignment per column.\n* Configurable content padding per column.\n* Configurable column width.\n* Text wrapping.\n\n<a name=\"table-usage\"></a>\n## Usage\n\nTable data is described using an array (rows) of array (cells).\n\n```js\nimport {\n  table\n} from 'table';\n\n// Using commonjs?\n// const {table} = require('table');\n\nlet data,\n    output;\n\ndata = [\n    ['0A', '0B', '0C'],\n    ['1A', '1B', '1C'],\n    ['2A', '2B', '2C']\n];\n\n/**\n * @typedef {string} table~cell\n */\n\n/**\n * @typedef {table~cell[]} table~row\n */\n\n/**\n * @typedef {Object} table~columns\n * @property {string} alignment Cell content alignment (enum: left, center, right) (default: left).\n * @property {number} width Column width (default: auto).\n * @property {number} truncate Number of characters are which the content will be truncated (default: Infinity).\n * @property {number} paddingLeft Cell content padding width left (default: 1).\n * @property {number} paddingRight Cell content padding width right (default: 1).\n */\n\n/**\n * @typedef {Object} table~border\n * @property {string} topBody\n * @property {string} topJoin\n * @property {string} topLeft\n * @property {string} topRight\n * @property {string} bottomBody\n * @property {string} bottomJoin\n * @property {string} bottomLeft\n * @property {string} bottomRight\n * @property {string} bodyLeft\n * @property {string} bodyRight\n * @property {string} bodyJoin\n * @property {string} joinBody\n * @property {string} joinLeft\n * @property {string} joinRight\n * @property {string} joinJoin\n */\n\n/**\n * Used to dynamically tell table whether to draw a line separating rows or not.\n * The default behavior is to always return true.\n *\n * @typedef {function} drawJoin\n * @param {number} index\n * @param {number} size\n * @return {boolean}\n */\n\n/**\n * @typedef {Object} table~config\n * @property {table~border} border\n * @property {table~columns[]} columns Column specific configuration.\n * @property {table~columns} columnDefault Default values for all columns. Column specific settings overwrite the default values.\n * @property {table~drawJoin} drawHorizontalLine\n */\n\n/**\n * Generates a text table.\n *\n * @param {table~row[]} rows\n * @param {table~config} config\n * @return {String}\n */\noutput = table(data);\n\nconsole.log(output);\n```\n\n```\n╔════╤════╤════╗\n║ 0A │ 0B │ 0C ║\n╟────┼────┼────╢\n║ 1A │ 1B │ 1C ║\n╟────┼────┼────╢\n║ 2A │ 2B │ 2C ║\n╚════╧════╧════╝\n```\n\n\n<a name=\"table-usage-cell-content-alignment\"></a>\n### Cell Content Alignment\n\n`{string} config.columns[{number}].alignment` property controls content horizontal alignment within a cell.\n\nValid values are: \"left\", \"right\" and \"center\".\n\n```js\nlet config,\n    data,\n    output;\n\ndata = [\n    ['0A', '0B', '0C'],\n    ['1A', '1B', '1C'],\n    ['2A', '2B', '2C']\n];\n\nconfig = {\n    columns: {\n        0: {\n            alignment: 'left',\n            minWidth: 10\n        },\n        1: {\n            alignment: 'center',\n            minWidth: 10\n        },\n        2: {\n            alignment: 'right',\n            minWidth: 10\n        }\n    }\n};\n\noutput = table(data, config);\n\nconsole.log(output);\n```\n\n```\n╔════════════╤════════════╤════════════╗\n║ 0A         │     0B     │         0C ║\n╟────────────┼────────────┼────────────╢\n║ 1A         │     1B     │         1C ║\n╟────────────┼────────────┼────────────╢\n║ 2A         │     2B     │         2C ║\n╚════════════╧════════════╧════════════╝\n```\n\n<a name=\"table-usage-column-width\"></a>\n### Column Width\n\n`{number} config.columns[{number}].width` property restricts column width to a fixed width.\n\n```js\nlet data,\n    output,\n    options;\n\ndata = [\n    ['0A', '0B', '0C'],\n    ['1A', '1B', '1C'],\n    ['2A', '2B', '2C']\n];\n\noptions = {\n    columns: {\n        1: {\n            width: 10\n        }\n    }\n};\n\noutput = table(data, options);\n\nconsole.log(output);\n```\n\n```\n╔════╤════════════╤════╗\n║ 0A │ 0B         │ 0C ║\n╟────┼────────────┼────╢\n║ 1A │ 1B         │ 1C ║\n╟────┼────────────┼────╢\n║ 2A │ 2B         │ 2C ║\n╚════╧════════════╧════╝\n```\n\n<a name=\"table-usage-custom-border\"></a>\n### Custom Border\n\n`{object} config.border` property describes characters used to draw the table border.\n\n```js\nlet config,\n    data,\n    output;\n\ndata = [\n    ['0A', '0B', '0C'],\n    ['1A', '1B', '1C'],\n    ['2A', '2B', '2C']\n];\n\nconfig = {\n    border: {\n        topBody: `─`,\n        topJoin: `┬`,\n        topLeft: `┌`,\n        topRight: `┐`,\n\n        bottomBody: `─`,\n        bottomJoin: `┴`,\n        bottomLeft: `└`,\n        bottomRight: `┘`,\n\n        bodyLeft: `│`,\n        bodyRight: `│`,\n        bodyJoin: `│`,\n\n        joinBody: `─`,\n        joinLeft: `├`,\n        joinRight: `┤`,\n        joinJoin: `┼`\n    }\n};\n\noutput = table(data, config);\n\nconsole.log(output);\n```\n\n```\n┌────┬────┬────┐\n│ 0A │ 0B │ 0C │\n├────┼────┼────┤\n│ 1A │ 1B │ 1C │\n├────┼────┼────┤\n│ 2A │ 2B │ 2C │\n└────┴────┴────┘\n```\n\n<a name=\"table-usage-draw-horizontal-line\"></a>\n### Draw Horizontal Line\n\n`{function} config.drawHorizontalLine` property is a function that is called for every non-content row in the table. The result of the function `{boolean}` determines whether a row is drawn.\n\n```js\nlet data,\n    output,\n    options;\n\ndata = [\n    ['0A', '0B', '0C'],\n    ['1A', '1B', '1C'],\n    ['2A', '2B', '2C'],\n    ['3A', '3B', '3C'],\n    ['4A', '4B', '4C']\n];\n\noptions = {\n    /**\n     * @typedef {function} drawJoin\n     * @param {number} index\n     * @param {number} size\n     * @return {boolean}\n     */\n    drawHorizontalLine: (index, size) => {\n        return index === 0 || index === 1 || index === size - 1 || index === size;\n    }\n};\n\noutput = table(data, options);\n\nconsole.log(output);\n```\n\n```\n╔════╤════╤════╗\n║ 0A │ 0B │ 0C ║\n╟────┼────┼────╢\n║ 1A │ 1B │ 1C ║\n║ 2A │ 2B │ 2C ║\n║ 3A │ 3B │ 3C ║\n╟────┼────┼────╢\n║ 4A │ 4B │ 4C ║\n╚════╧════╧════╝\n```\n\n<a name=\"table-usage-padding-cell-content\"></a>\n### Padding Cell Content\n\n`{number} config.columns[{number}].paddingLeft` and `{number} config.columns[{number}].paddingRight` properties control content padding within a cell. Property value represents a number of whitespaces used to pad the content.\n\n```js\nlet config,\n    data,\n    output;\n\ndata = [\n    ['0A', 'AABBCC', '0C'],\n    ['1A', '1B', '1C'],\n    ['2A', '2B', '2C']\n];\n\nconfig = {\n    columns: {\n        0: {\n            paddingLeft: 3\n        },\n        1: {\n            width: 2,\n            paddingRight: 3\n        }\n    }\n};\n\noutput = table(data, config);\n\nconsole.log(output);\n```\n\n```\n╔══════╤══════╤════╗\n║   0A │ AA   │ 0C ║\n║      │ BB   │    ║\n║      │ CC   │    ║\n╟──────┼──────┼────╢\n║   1A │ 1B   │ 1C ║\n╟──────┼──────┼────╢\n║   2A │ 2B   │ 2C ║\n╚══════╧══════╧════╝\n```\n\n<a name=\"table-usage-predefined-border-templates\"></a>\n### Predefined Border Templates\n\nYou can load one of the predefined border templates using `getBorderCharacters` function.\n\n```js\nimport {\n    table,\n    getBorderCharacters\n} from 'table';\n\nlet config,\n    data;\n\ndata = [\n    ['0A', '0B', '0C'],\n    ['1A', '1B', '1C'],\n    ['2A', '2B', '2C']\n];\n\nconfig = {\n    border: getBorderCharacters(`name of the template`)\n};\n\ntable(data, config);\n```\n\n```\n# honeywell\n\n╔════╤════╤════╗\n║ 0A │ 0B │ 0C ║\n╟────┼────┼────╢\n║ 1A │ 1B │ 1C ║\n╟────┼────┼────╢\n║ 2A │ 2B │ 2C ║\n╚════╧════╧════╝\n\n# norc\n\n┌────┬────┬────┐\n│ 0A │ 0B │ 0C │\n├────┼────┼────┤\n│ 1A │ 1B │ 1C │\n├────┼────┼────┤\n│ 2A │ 2B │ 2C │\n└────┴────┴────┘\n\n# ramac (ASCII; for use in terminals that do not support Unicode characters)\n\n+----+----+----+\n| 0A | 0B | 0C |\n|----|----|----|\n| 1A | 1B | 1C |\n|----|----|----|\n| 2A | 2B | 2C |\n+----+----+----+\n\n# void (no borders; see \"bordless table\" section of the documentation)\n\n 0A  0B  0C\n\n 1A  1B  1C\n\n 2A  2B  2C\n\n```\n\nRaise [an issue](https://github.com/gajus/table/issues) if you'd like to contribute a new border template.\n\n<a name=\"table-usage-predefined-border-templates-borderless-table\"></a>\n#### Borderless Table\n\nSimply using \"void\" border character template creates a table with a lot of unnecessary spacing.\n\nTo create a more plesant to the eye table, reset the padding and remove the joining rows, e.g.\n\n```js\nlet output;\n\noutput = table(data, {\n    border: getBorderCharacters(`void`),\n    columnDefault: {\n        paddingLeft: 0,\n        paddingRight: 1\n    },\n    drawJoin: () => {\n        return false\n    }\n});\n\nconsole.log(output);\n```\n\n```\n0A 0B 0C\n1A 1B 1C\n2A 2B 2C\n```\n\n<a name=\"table-usage-streaming\"></a>\n### Streaming\n\n`table` package exports `createStream` function used to draw a table and append rows.\n\n`createStream` requires `{number} columnDefault.width` and `{number} columnCount` configuration properties.\n\n```js\nimport {\n    createStream\n} from 'table';\n\nlet config,\n    stream;\n\nconfig = {\n    columnDefault: {\n        width: 50\n    },\n    columnCount: 1\n};\n\nstream = createStream(config);\n\nsetInterval(() => {\n    stream.write([new Date()]);\n}, 500);\n```\n\n![Streaming current date.](./.README/streaming.gif)\n\n`table` package uses ANSI escape codes to overwrite the output of the last line when a new row is printed.\n\nThe underlying implementation is explained in this [Stack Overflow answer](http://stackoverflow.com/a/32938658/368691). \n\nStreaming supports all of the configuration properties and functionality of a static table (such as auto text wrapping, alignment and padding), e.g.\n\n```js\nimport {\n    createStream\n} from 'table';\n\nimport _ from 'lodash';\n\nlet config,\n    stream,\n    i;\n\nconfig = {\n    columnDefault: {\n        width: 50\n    },\n    columnCount: 3,\n    columns: {\n        0: {\n            width: 10,\n            alignment: 'right'\n        },\n        1: {\n            alignment: 'center',\n        },\n        2: {\n            width: 10\n        }\n    }\n};\n\nstream = createStream(config);\n\ni = 0;\n\nsetInterval(() => {\n    let random;\n\n    random = _.sample('abcdefghijklmnopqrstuvwxyz', _.random(1, 30)).join('');\n\n    stream.write([i++, new Date(), random]);\n}, 500);\n```\n\n![Streaming random data.](./.README/streaming-random.gif)\n<a name=\"table-usage-text-truncation\"></a>\n### Text Truncation\n\nTo handle a content that overflows the container width, `table` package implements [text wrapping](#table-usage-text-wrapping). However, sometimes you may want to truncate content that is too long to be displayed in the table.\n\n`{number} config.columns[{number}].truncate` property (default: `Infinity`) truncates the text at the specified length.\n\n```js\nlet config,\n    data,\n    output;\n\ndata = [\n    ['Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus pulvinar nibh sed mauris convallis dapibus. Nunc venenatis tempus nulla sit amet viverra.']\n];\n\nconfig = {\n    columns: {\n        0: {\n            width: 20,\n            truncate: 100\n        }\n    }\n};\n\noutput = table(data, config);\n\nconsole.log(output);\n```\n\n```\n╔══════════════════════╗\n║ Lorem ipsum dolor si ║\n║ t amet, consectetur  ║\n║ adipiscing elit. Pha ║\n║ sellus pulvinar nibh ║\n║ sed mauris conva...  ║\n╚══════════════════════╝\n```\n\n<a name=\"table-usage-text-wrapping\"></a>\n### Text Wrapping\n\n`table` package implements auto text wrapping, i.e. text that has width greater than the container width will be separated into multiple lines, e.g.\n\n```js\nlet config,\n    data,\n    output;\n\ndata = [\n    ['Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus pulvinar nibh sed mauris convallis dapibus. Nunc venenatis tempus nulla sit amet viverra.']\n];\n\nconfig = {\n    columns: {\n        0: {\n            width: 20\n        }\n    }\n};\n\noutput = table(data, config);\n\nconsole.log(output);\n```\n\n```\n╔══════════════════════╗\n║ Lorem ipsum dolor si ║\n║ t amet, consectetur  ║\n║ adipiscing elit. Pha ║\n║ sellus pulvinar nibh ║\n║ sed mauris convallis ║\n║ dapibus. Nunc venena ║\n║ tis tempus nulla sit ║\n║ amet viverra.        ║\n╚══════════════════════╝\n```\n\nWhen `wrapWord` is `true` the text is broken at the nearest space or one of the special characters (\"-\", \"_\", \"\\\", \"/\", \".\", \",\", \";\"), e.g.\n\n```js\nlet config,\n    data,\n    output;\n\ndata = [\n    ['Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus pulvinar nibh sed mauris convallis dapibus. Nunc venenatis tempus nulla sit amet viverra.']\n];\n\nconfig = {\n    columns: {\n        0: {\n            width: 20,\n            wrapWord: true\n        }\n    }\n};\n\noutput = table(data, config);\n\nconsole.log(output);\n```\n\n```\n╔══════════════════════╗\n║ Lorem ipsum dolor    ║\n║ sit amet,            ║\n║ consectetur          ║\n║ adipiscing elit.     ║\n║ Phasellus pulvinar   ║\n║ nibh sed mauris      ║\n║ convallis dapibus.   ║\n║ Nunc venenatis       ║\n║ tempus nulla sit     ║\n║ amet viverra.        ║\n╚══════════════════════╝\n```\n\n",
  "readmeFilename": "README.md",
  "repository": {
    "type": "git",
    "url": "git+https://github.com/gajus/table.git"
  },
  "scripts": {
    "build": "rm -fr ./dist && NODE_ENV=production babel --copy-files ./src --out-dir ./dist && npm run make-validators",
    "lint": "npm run build && eslint ./src ./tests",
    "make-readme": "gitdown ./.README/README.md --output-file ./README.md",
    "make-validators": "ajv compile --all-errors --inline-refs=false -s src/schemas/config -c ajv-keywords/keywords/typeof -o dist/validateConfig.js && ajv compile --all-errors --inline-refs=false -s src/schemas/streamConfig -c ajv-keywords/keywords/typeof -o dist/validateStreamConfig.js",
    "precommit": "npm run lint && npm run test",
    "prepublish": "NODE_ENV=production npm run build",
    "test": "npm run build && nyc --check-coverage mocha"
  },
  "version": "4.0.2"
}
