Skip to content

Release/v0.1.0 alpha #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jun 8, 2024
Merged
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ A Workflow that runs on pull requests and diffs any api changes based on

```bash
npm install
npm run package:local # This compiles ts files and watches for changes
npm run package:watch:local # This compiles ts files and watches for changes
npm run dev:nodemon # This starts a local development server on localhost:5050
```

Expand Down
2 changes: 1 addition & 1 deletion badges/coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
274 changes: 219 additions & 55 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions src/formatters/table-from-object.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
type TableArgType<T> = {
headers: string[]
dataIndex: string[]
rows: T[]
}

export const tableFromObject = <T extends { [key: string]: string }>({
headers,
dataIndex,
rows
}: TableArgType<T>): string => {
const headerRow = headers.join(' | ')
const headerSeparator = headers.map(() => '---').join(' | ')
const bodyRows = rows
.map(row => {
return dataIndex.map(index => row[index]).join(' | ')
})
.join('\n')

return `${headerRow}\n${headerSeparator}\n${bodyRows}`
}
Loading
Loading