-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathkey-error.js
More file actions
31 lines (26 loc) · 786 Bytes
/
Copy pathkey-error.js
File metadata and controls
31 lines (26 loc) · 786 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
require("../test/example-utils.js").quickInit()
const Table = require("../")
const chalk = require("chalk")
const makeRed = function (val) {
if (val === "") {
return this.style("?", "white", "bgRed")
}
return val
}
const header = [
{ value: "Name", formatter: makeRed },
{ value: "Email", formatter: makeRed },
{ value: "Note" }
]
const data = [
{ Name: "Jane", Email: "jane@fake.com", Note: "All keys correct" },
{ XName: "Joel", XEmail: "joel@fake.com", Note: "Misspelled keys XName and XEmail" },
{ Name: "Mike", Email: "mike@fake.com", Note: "All keys correct" }
]
// With color
console.log(Table(header, data).render())
// Without color
console.log("\nCI=1:\n")
chalk.level = 0
const noColorTable = Table(header, data)
console.log(noColorTable.render())