Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bernardini687/minitable
🦕 deno utility module for simple table printing
https://github.com/bernardini687/minitable
deno minimal module
Last synced: 3 days ago
JSON representation
🦕 deno utility module for simple table printing
- Host: GitHub
- URL: https://github.com/bernardini687/minitable
- Owner: bernardini687
- License: mit
- Created: 2020-05-20T07:02:26.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-05-27T06:09:43.000Z (over 4 years ago)
- Last Synced: 2024-10-17T01:19:19.396Z (29 days ago)
- Topics: deno, minimal, module
- Language: TypeScript
- Homepage: https://deno.land/x/minitable
- Size: 10.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# minitable
_shape a list of data into a table_
simple helper to get a string designed to be printed as a table.
# usage
```ts
import { table } from 'https://deno.land/x/[email protected]/mod.ts'const fruits = [
{ name: 'mango', color: 'orange', quantity: 3 },
{ name: 'lemon', color: 'yellow', quantity: 1 },
{ name: 'strawberry', color: '', quantity: 5 },
{ name: 'tomato', color: 'red', quantity: 17 },
]// change the order of the columns
const t = table(fruits, ['quantity', 'color', 'name'])console.log(t)
/*
quantity color name
3 orange mango
1 yellow lemon
5 strawberry
17 red tomato
*/
```# options
```ts
// pick the properties to show
const t = table(fruits, ['color', 'name'], {
padding: 4,
upcaseHeader: true,
emptyReplacer: 'NO DATA POINT',
})console.log(t)
/*
COLOR NAME
orange mango
yellow lemon
NO DATA POINT strawberry
red tomato
*/
```