{"id":19973322,"url":"https://github.com/jsmith/pretty-table","last_synced_at":"2026-06-06T18:32:20.310Z","repository":{"id":131851229,"uuid":"98905371","full_name":"jsmith/pretty-table","owner":"jsmith","description":"A simple JavaScript library to render and compare tables","archived":false,"fork":false,"pushed_at":"2017-08-24T11:15:52.000Z","size":142,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-12T09:30:37.496Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/jsmith.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":"2017-07-31T15:45:37.000Z","updated_at":"2017-08-09T17:57:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"1b46f822-79d1-4175-856f-415f8efcdeb1","html_url":"https://github.com/jsmith/pretty-table","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsmith%2Fpretty-table","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsmith%2Fpretty-table/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsmith%2Fpretty-table/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsmith%2Fpretty-table/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jsmith","download_url":"https://codeload.github.com/jsmith/pretty-table/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241406074,"owners_count":19957949,"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-11-13T03:11:12.281Z","updated_at":"2025-11-25T18:02:53.188Z","avatar_url":"https://github.com/jsmith.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pretty Table\nA simple library to render tables from models and to compare tables. \n  \nHere is a [demo](https://jacsmith21.github.io/pretty-table/)!\n\nDownload it [here](https://raw.githubusercontent.com/jacsmith21/pretty-table/master/build/pretty-table.min.js)!\n\n## Dependencies\n\n* Backbone 1.1.2 (code structure) \n* Underscore 1.7.0 (utils)\n* JQuery 1.11.1 (DOM manipulation)\n* [pretty-json](https://github.com/jacsmith21/pretty-json) (Rendering JSON objects)\n\n## Usage\n\n```javascript\nvar data1 = {\n    headers:[\"ApplicationName\", \"ApplicationVersion\"],\n    models:[\n        {\n            \"ApplicationName\": \"zee App Name\",\n            \"ApplicationVersion\": \"5\",\n            \"somethingelse\": \"wow\"\n        },\n        {\n            \"ApplicationName\": \"ppA Name\",\n            \"ApplicationVersion\": \"4\"\n        },\n        {\n            \"ApplicationName\": \"App Name\",\n            \"ApplicationVersion\": \"5\"\n        }\n    ]\n};\n\nvar data2 = {\n    headers:[\"ApplicationName\", \"ApplicationVersion\"],\n    models:[\n        {\n            \"ApplicationName\": \"zee App Name\",\n            \"ApplicationVersion\": \"5\",\n            \"somethingelse\": \"wow\"\n        },\n        {\n            \"ApplicationName\": \"ppA Name\",\n            \"ApplicationVersion\": \"4\"\n        },\n        {\n            \"ApplicationName\": \"App Name\",\n            \"ApplicationVersion\": \"5\"\n        }\n    ]\n};\n\n//to render a table with headers\nvar table1 = new PrettyTable.view.Table({\n    el: $('#elem1'),\n    headers: data.headers, //the headers are used to pull information from the model\n    models: data.models\n});\n\n//to render a table without headers\n//if headers aren't defined each row renders the complete model using pretty-json\nvar table2 = new PrettyTable.view.Table({\n    el: $('#elem2'),\n    models: data.models \n});\n\n//to render two tables and match them up using the keys\n//the keys make up the unique identifiers of each model so the rows can be matched\nvar comparer = new PrettyTable.view.Comparer({\n    el: $('#elem3'),\n    models1: data1.models,\n    models2: data2.models,\n    keys: [\"ApplicationName\", \"ApplicationVersion\"]\n});\n\n```\n\n## Properties\n\nPrettyTable.view.Comparer\n* el: DOM elem to append Comparer\n* models1: The models to display on the left hand side\n* models2: The models to display on the right hand side\n* headers: The headers for each table [optional]\n* keys: The unique identifiers of the models used to match the rows\n* importantInfo: Important information for rendering JSON objects (see [pretty-json](https://github.com/jacsmith21/pretty-json)) [optional]\n\nPrettyTable.view.Table\n* el: DOM elem to append the Table\n* models: The models for the rows\n* headers: The headers for each table [optional]\n* next: The function to call when the user clicks on the next button. The function is given (row, model) and expexts you to call row.update(newModel) with a new model [optional]\n* previous: The function to call when the user clicks on the previous button. The function is given (row, model) and expexts you to call row.update(newModel) with a new model [optional]\n\n## Building\nThe library is built using python with jsmin. To build the compressed file:\n\n1. Go to the build folder\n2. `$ pip install -r requirements.txt`\n3. Run build.py using python 3\n\n## Testing\nMocha and Chai are used to test this library. To run the tests:\n\n1. Install the dependencies: `$ npm install jquery jsdom underscore backbone mocha chai sinon sinon-chai testem`\n2. Run testem: `$ testem`\n3. Go to the webpage!\n\n## Important Information\n* Keys and headers are assumed to be in the first level of the models.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsmith%2Fpretty-table","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjsmith%2Fpretty-table","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsmith%2Fpretty-table/lists"}