{"name":"tty-table","version":"5.0.0","keywords":["table","table in bash","cli-table","terminal table","console table","cli table","console.table","ascii table"],"author":{"name":"Tecfu"},"license":"MIT","_id":"tty-table@5.0.0","maintainers":[{"name":"tecfu","email":"help@tecfu.com"}],"homepage":"https://github.com/tecfu/tty-table","bugs":{"url":"https://github.com/tecfu/tty-table/issues"},"bin":{"tty-table":"adapters/terminal-adapter.js"},"nyc":{"all":false,"include":["src/*.js","adapters/*.js"]},"dist":{"shasum":"40079895e6ef20886215e5dfa81b7b2bbfb6f343","tarball":"http://registry-npm.ywwl.com/tty-table/download/tty-table-5.0.0.tgz","fileCount":13,"integrity":"sha512-WhUmYKqKIGu0pGNAHxSE6hYEatb274MdmynDsNVIpRjfK/aT47cVuWTFkB09wTnZfIY9h4NcjYMvWD0VHzJkjQ==","signatures":[{"sig":"MEYCIQD/McfylV0FPdb77dttI/MK25hC21JEOkuRa8jwB8cnuQIhAPm9wMANCarNKuFP3qH4hAnVip4rwVT6NCRDaBRttI+S","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":50104,"size":15794,"noattachment":false,"key":"/tty-table/-/tty-table-5.0.0.tgz"},"main":"src/main.js","types":"src/factory.d.ts","engines":{"node":">=8.0.0"},"gitHead":"5673f16ff8ce8707299974601e632a02fd3b5a52","scripts":{"dist":"npx grunt browserify && npx rollup -c","lint":"npx eslint adapters/*.js src/*.js","tags":"npx grunt tags","test":"npx mocha","coverage":"npx nyc mocha","lint-fix":"npx eslint adapters/*.js src/*.js examples/*.js --fix","save-tests":"node npm_scripts/run-examples.js save","watch-tags":"npx grunt watch","lint-examples":"npx eslint examples/","view-examples":"node npm_scripts/run-examples.js view","prepublishOnly":"npm run dist","lint-fix-examples":"npx eslint examples/ --fix","report-to-coverio":"npx nyc report --reporter=text-lcov > coverage.lcov && ./node_modules/.bin/codecov -t ffe0f46d-c939-4302-b199-0f2de3e8c18a","report-to-coveralls":"npx nyc report --reporter=text-lcov | npx coveralls"},"_npmUser":{"name":"tecfu","email":"help@tecfu.com"},"repository":{"url":"git+https://github.com/tecfu/tty-table.git","type":"git"},"_npmVersion":"11.5.1","description":"Node cli table","directories":{},"_nodeVersion":"22.16.0","dependencies":{"csv":"^5.5.3","chalk":"^4.1.2","kleur":"^4.1.5","yargs":"^17.7.1","wcwidth":"^1.0.1","smartwrap":"^2.0.2","strip-ansi":"^6.0.1"},"preferGlobal":false,"_hasShrinkwrap":false,"devDependencies":{"nyc":"^15.0.0","chai":"^4.2.0","glob":"^7.1.6","grunt":"^1.1.0","husky":"^4.2.5","mocha":"^6.1.4","eslint":"^6.8.0","rollup":"^1.31.1","codecov":"^3.6.5","babelify":"^8.0.0","commander":"^4.1.1","coveralls":"^3.0.9","grunt-cli":"^1.3.2","babel-core":"^6.26.3","browserify":"^16.5.0","axios-error":"^1.0.4","grunt-shell":"^3.0.1","eslint-plugin-node":"^11.0.0","babel-preset-babili":"0.1.4","babel-preset-es2015":"^6.24.1","grunt-contrib-watch":"^1.1.0","mocha-lcov-reporter":"^1.3.0","eslint-plugin-import":"^2.20.1","eslint-plugin-promise":"^4.2.1","@rollup/plugin-replace":"^2.3.1","eslint-config-standard":"^14.1.0","eslint-plugin-standard":"^4.0.1","@rollup/plugin-commonjs":"^11.0.2","@rollup/plugin-node-resolve":"^7.1.1"},"defaultTestColumns":90,"_npmOperationalInternal":{"tmp":"tmp/tty-table_5.0.0_1762713108173_0.7075131080802082","host":"s3://npm-registry-packages-npm-production"},"readme":"# tty-table\n\nA TypeScript-first terminal table renderer with a compatibility-oriented factory API.\n\n## [Examples](examples/)\n\n[See here for complete example list](examples/)\n\n\nTo view all example output:\n\n```sh\n$ git clone https://github.com/tecfu/tty-table && cd tty-table && npm i\n$ npm run view-examples\n```\n\n### Terminal (Static)\n\n[examples/styles-and-formatting.js](examples/styles-and-formatting.js)\n\n![Static](https://cloud.githubusercontent.com/assets/7478359/15691679/07142030-273f-11e6-8f1e-25728d558a2d.png \"Static Example\") \n\n### Terminal (Streaming)\n\n```\n$ node examples/data/fake-stream.js | tty-table --format json --header examples/config/header.js\n```\n\n![Streaming](https://user-images.githubusercontent.com/7478359/51738817-47c25700-204d-11e9-9df1-04e478331658.gif \"tty-table streaming example\") \n\n- See the built-in help for the terminal version of tty-table with: \n```\n$ tty-table -h\n```\n\n### MCP server\n\nExpose tty-table to MCP clients (Claude, IDE agents, Cursor, etc.) over stdio.\n\n#### Client configuration\n\n```json\n{\n  \"mcpServers\": {\n    \"tty-table\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"--package=tty-table\", \"tty-table-mcp\"]\n    }\n  }\n}\n```\n\n#### Tools\n\n| Tool | Description |\n|------|-------------|\n| `render_table` | Render data as an ASCII/Unicode terminal table. Accepts `header`, `rows`, and any tty-table `options`; returns the rendered table as text. |\n\n**Arguments for `render_table`:**\n\n| Name | Type | Required | Description |\n|------|------|----------|-------------|\n| `header` | `(string \\| {value, align?, width?})[]` | no | Column definitions |\n| `rows` | `(unknown[] \\| Record<string, unknown>)[]` | yes | Row data (arrays of cells, or objects keyed by column name) |\n| `options` | `object` | no | Any tty-table option (e.g. `width`, `borderStyle`, `align`, `compact`) |\n\nExample tool call:\n\n```json\n{\n  \"header\": [{ \"value\": \"name\" }, { \"value\": \"score\", \"align\": \"right\" }],\n  \"rows\": [[\"Ada\", 100], [\"Grace\", 98]],\n  \"options\": { \"width\": 40 }\n}\n```\n\nRendered result:\n\n```text\n  ┌───────┬───────┐\n  │ name  │ score │\n  ├───────┼───────┤\n  │  Ada  │   100 │\n  ├───────┼───────┤\n  │ Grace │    98 │\n  └───────┴───────┘\n```\n\n> Additional tools may be added in future releases under the same MCP server.\n\n### Browser & Browser Console\n\nThe published package ships a standalone IIFE bundle that exposes a `TtyTable` global. Load it directly from a CDN — no install or build step required:\n\n```html\n<script src=\"https://cdn.jsdelivr.net/npm/tty-table@7/dist/browser/tty-table.global.js\"></script>\n<script>\n  const Table = TtyTable.default\n  console.log(Table([{ value: \"name\" }, { value: \"score\" }], [[\"Ada\", 100]], null).render())\n</script>\n```\n\n- Try it online before installing: [live example on JSFiddle](https://jsfiddle.net/u9dqv14j/)\n- View the full example locally in Chrome or Chromium by opening [examples/browser-example.html](examples/browser-example.html) (e.g. served with `npx serve .` or any static file server).\n- [source: examples/browser-example.html](examples/browser-example.html)\n\n![Browser Console Example](https://user-images.githubusercontent.com/7478359/74614563-cbcaff00-50e6-11ea-9101-5457497696b8.jpg \"tty-table in the browser console\") \n\n<br/>\n<br/>\n\n## Compatibility\n\n### Node.js\n\n**Current releases require Node.js 22 or newer.** This is a breaking change from the Node 20 baseline used by early v6 releases (and from the v5 line, which supported older Node.js releases). The floor was raised to match `smartwrap@4` / `breakword@2.1.0`. If your application must remain on Node 20, stay on a prior tty-table release until you can upgrade.\n\nThe published package provides both ESM and CommonJS entry points for Node.js. The CLI requires Node.js 22+ as well.\n\n## API\n\n```ts\nimport Table from \"tty-table\"\n\nconst table = Table(\n  [{ value: \"name\" }, { value: \"score\", align: \"right\" }],\n  [\n    { name: \"Ada\", score: 100 },\n    { name: \"Grace\", score: 98 }\n  ],\n  { borderStyle: \"solid\" }\n)\n\nconsole.log(table.render())\n```\n\nLegacy `Table(header, rows, footer, options)` and `Table(rows, options)` construction remains supported.\n\n### Formatter context\n\nNew code can use the explicit context form:\n\n```ts\nconst formatter = (value: unknown) => String(value).toUpperCase()\n```\n\nThe compatibility callback signature is still accepted. New integrations should prefer a formatter that accepts the documented context object and avoid relying on dynamic `this` mutation.\n\n### Width semantics\n\nWidths are measured in terminal display columns, not JavaScript string length. ANSI escape sequences are ignored for measurement; Unicode code points are counted using [`breakword.width()`](https://github.com/tecfu/breakword) (Unicode 18.0.0 East Asian Width + UAX #51 Emoji_Presentation). Wrapping and truncation operate on the same display-width semantics.\n\nCompared with older releases that used `wcwidth`, some symbols that were previously treated as 1 cell are now 2 cells (for example `⚡` U+26A1). Tables containing those characters may reflow slightly; measurement is now aligned with the same library used for wrapping.\n\n## Development\n\n```sh\nnpm install\nnpm run typecheck\nnpm run build\nnpm test\nnpm run test:unit\nnpm run lint\n```\n","publish_time":1762713108353,"_cnpm_publish_time":1762713108353,"dist-tags":{"latest":"7.2.1"}}