{"name":"console-table-printer","version":"2.4.25","keywords":["console-table","console-log","print-table","node-table-printing"],"author":{"name":"Nahiyan Kamal"},"license":"MIT","_id":"console-table-printer@2.4.25","maintainers":[{"name":"ayonknan","email":"jaissatai6@gmail.com"}],"homepage":"https://console-table.netlify.app","bugs":{"url":"https://github.com/ayonious/console-table-printer/issues"},"dist":{"shasum":"4f0b8351d48a214a217780b7032cd2dd83579aa1","tarball":"http://registry-npm.ywwl.com/console-table-printer/download/console-table-printer-2.4.25.tgz","fileCount":19,"integrity":"sha512-Cd2xpJJ2EatmYJrzcmf/d4/CXai/vZkUyX2kZwWYp6Fb8Hn8um6pYwaeAQXv3m1hybQq6gQwwPwfrFQBA5QeMQ==","signatures":[{"sig":"MEUCIQDn/XaZ1lc7Nol5QQCxRZHUYLXTVo4MnoOUqMdGYZH7rgIgNLKS3mJhMI2XtiJoHBxy1oTj8zrLeDUVCbxQkzON7v0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":30242,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfkI01CRA9TVsSAnZWagAAUkoP/2ci0tfm2imdgOE9a5EG\nAuzOuNU+LQikP69mMGdxFT7HYsezAhnoNPKBy2gkEcqSEv4YclqzrSrINS6n\n8MUVhRmZe7UWO6184bQfLrgPYxWE94HBuurVWKhAQAr9fRaQQp97RYL9JmFJ\nLwiu90S76bUrkDbL4o4Xvubdw5ap2HlprT4OL0incH7gzyvmKDpHhFWNWG+d\nass8IylZYLnIy3jLlVHg/TxGQtMD8xWGieqJr7EQhJhF+fhc2eS+ua1MZpHK\n8cQMu+y1SWOfb/6bCSYg3nyxQz8ovnEuhOEY6IdfmFajy9t+kNM3M7d5Bq5A\nSMAL17n2txlPwc6doeg7jVdkw9X85pIt0AU73blTxhU1qYCKW3apLiLKuVHE\nmeKQEt05vsxTP1pFdHiWdGRD6gdsoDiYlW77nFA8gL40YqGsK9kx7CIq+ZBI\n71oj3kPRzmPEaQZcI1LenqmM7HHnDOE/+GJqjxpC85Z7rlIxD2IVpw1c9bel\n3z/rZdboh2Gi9L1zP1bHq4o6WSjDkN9lwIJVJ0PTynVwq6xC0Y9Qw5KE1J6r\nOLBQ5VLeRwyB1IIf+3Hn3vsrkmT2I9cKMs1AGb63hA8J0NMni/KF1riQS3fJ\n1dzhc9J+0TjAyz/MlAO5pDuYMn2IcJuWCrcvuEdc8H3g3HROFNfKGsBvzpSc\nGKI6\r\n=l4bV\r\n-----END PGP SIGNATURE-----\r\n","size":7991,"noattachment":false,"key":"/console-table-printer/-/console-table-printer-2.4.25.tgz"},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"baebf3acafd28943d560ca36545918322de99fb9","scripts":{"lint":"eslint --ext=js,ts .","test":"jest --config jestconfig.json","build":"tsc","setup":"npm install","format":"prettier --write \"**/*.{json,md,ts,tsx,yml,js,jsx}\""},"_npmUser":{"name":"ayonknan","email":"jaissatai6@gmail.com"},"repository":{"url":"git+https://github.com/ayonious/console-table-printer.git","type":"git"},"_npmVersion":"6.14.8","description":"Printing pretty tables on console log","directories":{},"_nodeVersion":"12.19.0","_hasShrinkwrap":false,"devDependencies":{"jest":"^26.6.0","husky":"^4.3.0","eslint":"^7.11.0","ts-jest":"^26.4.1","prettier":"^2.1.2","typescript":"^4.0.3","@types/jest":"^26.0.15","pretty-quick":"^3.1.0","eslint-plugin-import":"^2.22.1","eslint-config-prettier":"^6.14.0","eslint-plugin-prettier":"^3.1.4","@typescript-eslint/parser":"^4.5.0","eslint-config-airbnb-base":"^14.2.0","@typescript-eslint/eslint-plugin":"^4.5.0"},"_npmOperationalInternal":{"tmp":"tmp/console-table-printer_2.4.25_1603308852970_0.6997551962157162","host":"s3://npm-registry-packages"},"readme":"<h1 align=\"center\">console-table-printer</h1>\n\n> 🖥️🍭 Printing pretty tables in your console\n\n![NPM Downloads](https://img.shields.io/npm/dw/console-table-printer)\n[![install size](https://packagephobia.com/badge?p=console-table-printer)](https://packagephobia.com/result?p=console-table-printer)\n[![npm version](https://badge.fury.io/js/console-table-printer.svg)](https://badge.fury.io/js/console-table-printer)\n[![codecov](https://codecov.io/gh/console-table-printer/console-table-printer/graph/badge.svg?token=SWX9VBuYUs)](https://codecov.io/gh/console-table-printer/console-table-printer)\n\n## Synopsis\n\nPrint simple tables with colored rows in your console. It's useful when you want to present tables in console output using JS.\n\n## Installation\n\n```bash\nnpm install console-table-printer --save\n```\n\n## Basic Example\n\n```typescript\nimport { printTable } from 'console-table-printer';\n\n// Create a simple task list\nconst tasks = [\n  { id: 1, task: 'Fix login bug', priority: 'High', status: 'In Progress' },\n  { id: 2, task: 'Update documentation', priority: 'Medium', status: 'Done' },\n  { id: 3, task: 'Add unit tests', priority: 'High', status: 'Todo' },\n];\n\n// Print the table\nprintTable(tasks);\n```\n\n![Screenshot](https://cdn.jsdelivr.net/gh/console-table-printer/console-table-printer@master/static-resources/Example-1-basic.png)\n\n## 🚨🚨Announcement🚨🚨 Official documentation has moved [here](https://console-table.netlify.app/docs)\n\nYou can also create a Table instance and print it:\n\n```typescript\nimport { Table } from 'console-table-printer';\n\n// Create a game leaderboard\nconst leaderboard = new Table();\n\n// Add players with their scores\nleaderboard.addRow({ rank: 1, player: 'Alice', score: 1250, level: 'Master' });\nleaderboard.addRow({ rank: 2, player: 'Bob', score: 1180, level: 'Expert' });\nleaderboard.addRows([\n  { rank: 3, player: 'Charlie', score: 1050, level: 'Advanced' },\n  { rank: 4, player: 'Diana', score: 920, level: 'Intermediate' },\n]);\n\n// Print the leaderboard\nleaderboard.printTable();\n```\n\n![Screenshot](https://cdn.jsdelivr.net/gh/console-table-printer/console-table-printer@master/static-resources/Example-2-instance.png)\n\nYou can also add color to your table like this:\n\n```typescript\nimport { Table } from 'console-table-printer';\n\nconst p = new Table();\np.addRow({ item: 'Pizza', price: 12.99, rating: '5/5' }, { color: 'red' });\np.addRow({ item: 'Burger', price: 8.99, rating: '4/5' }, { color: 'green' });\np.addRow({ item: 'Ramen', price: 15.99, rating: '5/5' }, { color: 'yellow' });\np.addRow({ item: 'Salad', price: 6.99, rating: '3/5' }, { color: 'cyan' });\np.printTable();\n```\n\n![Screenshot](https://cdn.jsdelivr.net/gh/console-table-printer/console-table-printer@master/static-resources/Example-3-color.png)\n\nYou can also configure column properties (color/alignment/title).\n\n```typescript\nimport { Table } from 'console-table-printer';\n\nconst p = new Table({\n  title: 'Project Status',\n  columns: [\n    { name: 'id', alignment: 'left', color: 'blue' },\n    { name: 'project', alignment: 'left' },\n    { name: 'status', title: 'Current Status' },\n  ],\n  colorMap: {\n    urgent: '\\x1b[31m',\n    on_track: '\\x1b[32m',\n  },\n});\n\np.addRow({ id: 1, project: 'Website Redesign', status: 'On Track' }, { color: 'on_track' });\np.addRow({ id: 2, project: 'Mobile App', status: 'Behind Schedule' }, { color: 'urgent' });\np.addRow({ id: 3, project: 'API Integration', status: 'Completed' }, { color: 'green' });\n\np.printTable();\n```\n\n![Screenshot](https://cdn.jsdelivr.net/gh/console-table-printer/console-table-printer@master/static-resources/Example-4-columns.png)\n\n## CLI\n\nThere is also a CLI tool for printing tables directly in the terminal: [table-printer-cli](https://www.npmjs.com/package/table-printer-cli)\n\n## Documentation\n\nOfficial documentation has moved here: [console-table-documentation](https://console-table.netlify.app)\n\n### Table instance creation\n\nThree ways to create a Table instance:\n\n1. Simplest way: `new Table()`\n\n2. With column names only: `new Table(['column1', 'column2', 'column3'])`\n\n3. Detailed table instance creation:\n\n```typescript\nimport { Table } from 'console-table-printer';\n\nnew Table({\n  title: '📊 Sales Report Q4 2024', // Text shown above the table (optional)\n  columns: [\n    { name: 'region', alignment: 'left', color: 'blue' }, // with alignment and color\n    { name: 'sales', alignment: 'right', maxLen: 30 }, // lines bigger than this will be split into multiple lines\n    { name: 'growth', title: 'Growth %' }, // Title is shown while printing; by default, title = name\n    { name: 'price', transform: (value) => `$${Number(value).toFixed(2)}` }, // Transform function to format cell values before display\n  ],\n  rows: [\n    { region: 'North America', sales: '$2.5M', growth: '+15%' },\n    { region: 'Europe', sales: '$1.8M', growth: '+8%' },\n    { region: 'Asia Pacific', sales: '$3.2M', growth: '+22%' },\n  ],\n  sort: (row1, row2) => row2.sales - row1.sales, // sorting order of rows (optional), using the same comparator shape as Array.sort\n  filter: (row) => row.growth > '+10%', // filtering rows (optional)\n  enabledColumns: ['region', 'sales'], // array of columns that you want to see; all others will be ignored (optional)\n  disabledColumns: ['growth'], // array of columns that you don't want to see, these will always be hidden\n  colorMap: {\n    high_growth: '\\x1b[32m', // define a custom color\n  },\n  charLength: {\n    '👋': 2,\n    '😅': 2,\n  }, // custom character widths in the console\n  defaultColumnOptions: {\n    alignment: 'center',\n    color: 'red',\n    maxLen: 40,\n    minLen: 20,\n  },\n});\n```\n\n### Functions\n\n- `addRow(rowObject, options)` Adds a single row. This can be chained.\n- `addRows(rowObjects, options)` Adds multiple rows. This accepts an array of row objects. In this case, options will be applied to all rows.\n- `clearRows()` Removes all rows while keeping the table columns and options. This can be chained.\n- `addColumn(columnObject)` Adds a single column.\n- `addColumns(columnObjects)` Adds multiple columns.\n- `printTable()` Prints the table in your console.\n\n### Possible `color` values for rows\n\nCheck docs: [color-vals](https://console-table.netlify.app/docs/doc-color)\n\nExample usage: To create a blue row\n\n```typescript\ntable.addRow(rowObject, { color: 'blue' });\n```\n\nExample usage: To apply blue to all rows\n\n```typescript\ntable.addRows(rowsArray, { color: 'blue' });\n```\n\n### Possible `alignment` values for columns\n\nCheck docs: [alignment-vals](https://console-table.netlify.app/docs/doc-alignment)\n\n### TypeScript Support\n\nYou can get color and alignment as types. Check docs: [types-docs](https://console-table.netlify.app/docs/doc-typescript)\n\n## License\n\n[MIT](https://github.com/console-table-printer/console-table-printer/blob/master/LICENSE)\n","publish_time":1603308853106,"_cnpm_publish_time":1603308853106,"dist-tags":{"latest":"2.16.1"}}