{"id":16637673,"url":"https://github.com/timvandam/nice-table","last_synced_at":"2025-10-30T08:31:00.852Z","repository":{"id":45911363,"uuid":"514574367","full_name":"timvandam/nice-table","owner":"timvandam","description":"A non-overflowing `console.table` alternative with customization options.","archived":false,"fork":false,"pushed_at":"2022-07-17T19:58:01.000Z","size":10,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-02T07:22:27.345Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/timvandam.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-07-16T12:37:49.000Z","updated_at":"2022-08-04T08:35:35.000Z","dependencies_parsed_at":"2022-08-06T10:01:38.787Z","dependency_job_id":null,"html_url":"https://github.com/timvandam/nice-table","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timvandam%2Fnice-table","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timvandam%2Fnice-table/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timvandam%2Fnice-table/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timvandam%2Fnice-table/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/timvandam","download_url":"https://codeload.github.com/timvandam/nice-table/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238945669,"owners_count":19556700,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-12T06:42:20.696Z","updated_at":"2025-10-30T08:31:00.505Z","avatar_url":"https://github.com/timvandam.png","language":"TypeScript","readme":"# nice-table\nA non-overflowing `console.table` alternative with customization options.\n\n## Usage\n```ts\nimport { createTable } from 'nice-table';\n\ntype Person = {\n    name: string;\n    age: number;\n};\n\nconst myData: Person[] = [\n    { name: 'John', age: 30 },\n    { name: 'Jane', age: 25 },\n    { name: 'Joe', age: 20 },\n    {\n        name: 'Pablo Diego José Francisco de Paula Juan Nepomuceno María de los Remedios Cipriano de la Santísima Trinidad Ruiz y Picasso',\n        age: new Date(Date.now() - Date.UTC(1881, 3, 8)).getUTCFullYear() - 1970,\n    },\n];\n\nconsole.log(\n    createTable\u003cPerson\u003e(myData, ['name', 'age'], {\n        maxWidth: 60,\n        columnSizing: 'stretch',\n        horizontalAlignment: 'middle',\n        verticalAlignment: 'middle',\n        fullWidth: true,\n        indexColumn: false,\n        throwIfTooSmall: false,\n    }),\n);\n\n// Output:\n// ┌────────────────────────────────────────────────────┬─────┐\n// │                        name                        │ age │\n// ├────────────────────────────────────────────────────┼─────┤\n// │                        John                        │ 30  │\n// │                        Jane                        │ 25  │\n// │                        Joe                         │ 20  │\n// │      Pablo Diego José Francisco de Paula Juan      │     │\n// │  Nepomuceno María de los Remedios Cipriano de la   │ 141 │\n// │         Santísima Trinidad Ruiz y Picasso          │     │\n// └────────────────────────────────────────────────────┴─────┘\n```\n\n### Colored Output\n```ts\nimport * as util from 'node:util';\n\n// ...\n\nconsole.log(\n    createTable\u003cPerson\u003e(myData, ['name', 'age'], {\n        stringify: (value: unknown) =\u003e util.inspect(value, { colors: true }),\n    }),\n);\n```\n\n## Options\n### `maxWidth`\nThe maximum width of the table.\nThis width will never be exceeded by the table.\nCan be set to `process.stdout.columns` to use the terminal width in Node.js.\n\nDefaults to `80`.\n\n### `columnSizing`\nThe strategy used to determine the width of each column.\nThere are two possible values:\n- `'stretch'`: The size of each column is proportional to the length of its content. All columns larger than `maxWidth / columnCount` are shrunk by the same ratio in case the table is too large for the configured `maxWidth`.    \n- `'even'`: All columns will have the same size.\n\nDefaults to `'stretch'`.\n\n### `horizontalAlignment`\nThe horizontal alignment the text in all table cells. Possible values are `'left'`, `'middle'`, `'right'`.\n\nDefaults to `'middle'`.\n\n### `verticalAlignment`\nThe vertical alignment the text in all table cells. Possible values are `'top'`, `'middle'`, `'bottom'`.\n\nDefaults to `'middle'`.\n\n### `fullWidth`\nWhether to stretch the table to the `maxWidth`.\n\nDefaults to `false`.\n\n### `throwIfTooSmall`\nWhether to throw an error if the `maxWidth` is too small to fit the content.\n`maxWidth` should be at least `4 * columnCount + 1` to fit a table with `columnCount` columns.\n\nIf set to `false` will return a message indicating that there is not enough space to fit the table.\n\nDefaults to `true`.\n\n### `indexColumn`\nWhether to include an index column.\n\nDefaults to `false`.\n\n### `stringify`\nA function converts values into strings before they are is displayed.\nANSI codes are supported, so colored input can be achieved as shown in [Colored Output](#colored-output).\n\nDefaults to `String`.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimvandam%2Fnice-table","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimvandam%2Fnice-table","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimvandam%2Fnice-table/lists"}