{"id":23201065,"url":"https://github.com/codedotjs/omd","last_synced_at":"2025-04-05T09:26:20.271Z","repository":{"id":241613863,"uuid":"806429424","full_name":"CodeDotJS/omd","owner":"CodeDotJS","description":":feather: :feet: Convert arrays and objects to Markdown tables.","archived":false,"fork":false,"pushed_at":"2024-05-31T06:42:22.000Z","size":54,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-20T00:41:18.709Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://omd.vercel.app/","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/CodeDotJS.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":"2024-05-27T07:24:44.000Z","updated_at":"2024-11-24T15:02:14.000Z","dependencies_parsed_at":"2024-05-29T09:30:49.755Z","dependency_job_id":"a06abbf7-0c8e-435d-885d-5ef7f374d6b2","html_url":"https://github.com/CodeDotJS/omd","commit_stats":null,"previous_names":["codedotjs/ohmd","codedotjs/omd"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeDotJS%2Fomd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeDotJS%2Fomd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeDotJS%2Fomd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeDotJS%2Fomd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CodeDotJS","download_url":"https://codeload.github.com/CodeDotJS/omd/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247314544,"owners_count":20918858,"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-12-18T15:13:48.260Z","updated_at":"2025-04-05T09:26:20.221Z","avatar_url":"https://github.com/CodeDotJS.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# omd\n\n:feather: :feet: Convert arrays and objects to Markdown tables.\n\n\n## Install\n\n```\nnpm install ohmd\n```\n\n## API\n\n### `omd(data, options)`\n\n- `data`: The data to be converted into a Markdown table. It can be:\n    - A single array.\n    - An object with header and table properties.\n    - A 2D array where the first sub-array is the header and the remaining sub-arrays are the table rows.\n\n- `options`: Configuration options for the table formatting. It's optional.\n    - `align` - Specifies the alignment for each column. Valid values are `left`, `center`, and `right`. If not provided, the default alignment is used.\n\n\n### Examples\n\n- __Markdown for a single array:__\n\n```js\nconst omd = require('ohmd');\n\nconst arrayData = ['Jon', 'Doe'];\nconsole.log(omd(arrayData));\n\n// | --- |\n// | Jon |\n// | Doe |\n```\n\n```js\nconsole.log(omd(arrayData, { align: ['left'] }));\n\n// | :--- |\n// | Jon  |\n// | Doe  |\n```\n\n- __Markdown for an object with different alignments:__\n\n```js\nconst objectData = {\n    header: ['Day', 'Rank', 'Grade'],\n    table: [['Tuesday', 7, \"C Minus\"], ['Friday', 1, \"A Plus\"], ['Dryday', 4, \"B Minus\"]],\n};\n\nconsole.log(omd(objectData, { align: ['left', 'center', 'right'] }));\n\n// | Day     |   Rank  |    Grade |\n// | :---    |  :---:  |   ---:   |\n// | Tuesday |    7    |  C Minus |\n// | Friday  |    1    |  A Plus  |\n// | Dryday  |    4    |  B Minus |\n```\n\n- __Markdown for an object with no header:__\n\n```js\nconst objectWithoutHeader = {\n    \"table\": [\n        [\"Alice\", 30, \"New York\"],\n        [\"Bob\", 25, \"San Francisco\"],\n        [\"Charlie\", 35, \"Los Angeles\"]\n    ]\n}\n\n// | Alice   | 30 | New York      |\n// | Bob     | 25 | San Francisco |\n// | Charlie | 35 | Los Angeles   |\n```\n\n- __Markdown for an object with single alignment:__\n\n```js\nconsole.log(omd(objectData, { align: ['center'] }));\n\n// |   Day   |   Rank  |  Grade   |\n// | :---:   | :---:   | :---:    |\n// | Tuesday |    7    |  C Minus |\n// | Friday  |    1    |  A Plus  |\n// | Dryday  |    4    |  B Minus |\n```\n\n- __Markdown for a 2D array with different alignments:__\n\n```js\nconst twoDArrayData = [\n    ['name', 'class', 'number'],\n    ['Jon', 7, 99],\n    ['Ron', 13, 233],\n    ['Akon', 12, 13],\n];\n\nconsole.log(omd(twoDArrayData, { align: ['center', 'left', 'right'] }));\n\n// |   name  | class | number |\n// | :---:   | :---  |  ---:  |\n// |   Jon   |  7    |     99 |\n// |   Ron   |  13   |    233 |\n// |  Akon   |  12   |     13 |\n```\n\n- __Markdown for a 2D array with single alignment:__\n\n```js\nconsole.log(omd(twoDArrayData, { align: ['center'] }));\n\n// |  name  | class | number |\n// | :---:  | :---: | :---:  |\n// |  Jon   |   7   |   99   |\n// |  Ron   |  13   |  233   |\n// | Akon   |  12   |   13   |\n```\n\n# Contributing\nIf you find any bugs or have suggestions for improvements, please feel free to submit a pull request or open an issue.\n\n# License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodedotjs%2Fomd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodedotjs%2Fomd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodedotjs%2Fomd/lists"}