{"id":16644171,"url":"https://github.com/75lb/table-layout","last_synced_at":"2025-09-03T09:44:49.529Z","repository":{"id":34290546,"uuid":"38181008","full_name":"75lb/table-layout","owner":"75lb","description":"Styleable plain-text table generator. Useful for formatting console output.","archived":false,"fork":false,"pushed_at":"2024-11-16T12:44:19.000Z","size":689,"stargazers_count":25,"open_issues_count":1,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-20T13:12:57.347Z","etag":null,"topics":["javascript","layout","table","text-formatting","view"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"fatihacet/turkcekaynaklar-com","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/75lb.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-06-28T00:45:38.000Z","updated_at":"2025-05-29T22:20:11.000Z","dependencies_parsed_at":"2024-06-18T14:07:17.271Z","dependency_job_id":"97809b02-5e9c-4c35-a06c-7b13dc0ee80f","html_url":"https://github.com/75lb/table-layout","commit_stats":{"total_commits":212,"total_committers":5,"mean_commits":42.4,"dds":"0.018867924528301883","last_synced_commit":"33b065ea5e76ac4719bb427306e4532c02f73421"},"previous_names":["75lb/column-layout"],"tags_count":33,"template":false,"template_full_name":null,"purl":"pkg:github/75lb/table-layout","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/75lb%2Ftable-layout","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/75lb%2Ftable-layout/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/75lb%2Ftable-layout/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/75lb%2Ftable-layout/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/75lb","download_url":"https://codeload.github.com/75lb/table-layout/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/75lb%2Ftable-layout/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262906081,"owners_count":23382725,"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":["javascript","layout","table","text-formatting","view"],"created_at":"2024-10-12T08:10:39.239Z","updated_at":"2025-07-01T05:39:57.382Z","avatar_url":"https://github.com/75lb.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![view on npm](https://badgen.net/npm/v/table-layout)](https://www.npmjs.org/package/table-layout)\n[![npm module downloads](https://badgen.net/npm/dt/table-layout)](https://www.npmjs.org/package/table-layout)\n[![Gihub repo dependents](https://badgen.net/github/dependents-repo/75lb/table-layout)](https://github.com/75lb/table-layout/network/dependents?dependent_type=REPOSITORY)\n[![Gihub package dependents](https://badgen.net/github/dependents-pkg/75lb/table-layout)](https://github.com/75lb/table-layout/network/dependents?dependent_type=PACKAGE)\n[![Node.js CI](https://github.com/75lb/table-layout/actions/workflows/node.js.yml/badge.svg)](https://github.com/75lb/table-layout/actions/workflows/node.js.yml)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard)\n\n# table-layout\n\nStyleable plain-text table generator. Useful for formatting console output. Available as both a [command-line tool](https://github.com/75lb/table-layout-cli) and isomorphic Javascript library.\n\n## Install as a library\n\nAdd table-layout to your project:\n\n```\n$ npm install --save table-layout\n```\n\n## Display an array of objects as a table\n\nTrivial example. Read a JSON file from disk and output a table with a maximum width (in characters) of 60.\n\n```js\nimport Table from 'table-layout'\nimport { promises as fs } from 'fs'\n\nconst issues = await fs.readFile('./issues.json', 'utf8')\nconst table = new Table(JSON.parse(issues), { maxWidth: 60 })\n\nconsole.log(table.toString())\n\n```\n\nThis is the example input file:\n\n```json\n[\n  {\n    \"number\": 15134,\n    \"title\": \"Coveralls has no source available \",\n    \"login\": \"ndelangen\",\n    \"comments\": 0\n  },\n  {\n    \"number\": 15133,\n    \"title\": \"Fixing --preserve-symlinks. Enhancing node to exploit.\",\n    \"login\": \"phestermcs\",\n    \"comments\": 0\n  },\n  {\n    \"number\": 15131,\n    \"title\": \"Question - Confused about NPM's local installation philosophy\",\n    \"login\": \"the1mills\",\n    \"comments\": 0\n  },\n  {\n    \"number\": 15130,\n    \"title\": \"Question - global npm cache directory if user is root?\",\n    \"login\": \"ORESoftware\",\n    \"comments\": 0\n  }\n]\n```\n\nThis is the output:\n\n```\n 15134  Coveralls has no source available   ndelangen     0\n 15133  Fixing --preserve-symlinks.         phestermcs    0\n        Enhancing node to exploit.\n 15131  Question - Confused about NPM's     the1mills     0\n        local installation philosophy\n 15130  Question - global npm cache         ORESoftware   0\n        directory if user is root?\n 15127  how to installa gulp fontfacegen    aramgreat     0\n        on Windows 10\n 15097  Cannot install package from         mastertinner  3\n        tarball out of package.json entry\n        generated by npm\n 15067  npm \"SELF_SIGNED_CERT_IN_CHAIN\"     LegendsLyfe   3\n        error when installing discord.js\n        with .log\n```\n\n## Cherry-picked and computed values\n\nSometimes, your input data might contain a deeper structure or you want to transform or compute some values. Some example input data with structural depth and large numbers you'd like to reformat:\n\n```json\n[\n  {\n    \"country\": { \"name\": \"USA\" },\n    \"GDP\": 19485394000000,\n    \"population\": 325084756\n },\n  {\n    \"country\": { \"name\": \"China\" },\n    \"GDP\": 12237700479375,\n    \"population\": 1421021791\n  },\n  {\n    \"country\": { \"name\": \"Japan\" },\n    \"GDP\": 4872415104315,\n    \"population\": 127502725\n }\n]\n```\n\nExample usage of the column getter function: \n\n```js\nimport Table from 'table-layout'\nimport { promises as fs } from 'fs'\n\nconst rows = JSON.parse(await fs.readFile('./example/deep-data/gdp.json', 'utf8'))\nconst germanCurrency = new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' })\nconst germanNumber = new Intl.NumberFormat('de-DE', { notation: 'compact', maximumSignificantDigits: 3, maximumFractionDigits: 0 })\n\nconst table = new Table(rows, {\n  maxWidth: 60,\n  columns: [\n    {\n      name: 'country',\n      get: (cellValue) =\u003e cellValue.name\n    },\n    {\n      name: 'GDP',\n      get: (cellValue) =\u003e germanCurrency.format(cellValue)\n    },\n    {\n      name: 'population',\n      get: (cellValue) =\u003e germanNumber.format(cellValue)\n    },\n  ]\n})\n\nconsole.log(table.toString())\n```\n\nOutput.\n\n```\n$ node example/computed-values.js\n\n USA    19.485.394.000.000,00 €  325 Mio.\n China  12.237.700.479.375,00 €  1,42 Mrd.\n Japan  4.872.415.104.315,00 €   128 Mio.\n ```\n\n## Colour-scale conditional formatting\n\nSee [this file](https://github.com/75lb/table-layout/blob/master/example/colour-scale-formatting.js) for a example of colour-scale formatting (increasing intensity of red/green for more positive/negative values).\n\n\u003cimg src=\"https://raw.githubusercontent.com/75lb/table-layout/master/example/colour-scale.jpg\" width=\"600px\" title=\"Colour-scale\"\u003e\n\n## API Reference\n\nFor the full API documentation, see [here](https://github.com/75lb/table-layout/blob/master/docs/API.md).\n\n## Load anywhere\n\nThis library is compatible with Node.js, the Web and any style of module loader. It can be loaded anywhere, natively without transpilation.\n\nWithin a Node.js CommonJS Module:\n\n```js\nconst Table = require('table-layout')\n```\n\nWithin a Node.js ECMAScript Module:\n\n```js\nimport Table from 'table-layout'\n```\n\nWithin a modern browser ECMAScript Module:\n\n```js\nimport Table from './node_modules/table-layout/dist/index.mjs'\n```\n\n## See Also \n\n* [gfmt](https://github.com/75lb/gfmt): A github-flavoured-markdown table generator. \n\n* * *\n\n\u0026copy; 2015-24 [Lloyd Brookes](https://github.com/75lb) \\\u003copensource@75lb.com\\\u003e.\n\nIsomorphic test suite by [test-runner](https://github.com/test-runner-js/test-runner). Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F75lb%2Ftable-layout","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F75lb%2Ftable-layout","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F75lb%2Ftable-layout/lists"}