Skip to content

Commit a20ca93

Browse files
committed
Add support for boolean values
1 parent 60088b0 commit a20ca93

File tree

10 files changed

+17
-10
lines changed

10 files changed

+17
-10
lines changed

lib/ascii-data-table.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/ascii-data-table.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/bundle-angular.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/bundle-angular.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/bundle-react.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/bundle-react.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/bundle.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/bundle.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ascii-data-table.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const stringifyVal = (val) => {
44
if (Array.isArray(val)) return stringifyArray(val)
55
if (typeof val === 'number') return val
66
if (typeof val === 'string') return val
7+
if (typeof val === 'boolean') return val
78
if (val === null) return '(null)'
89
if (typeof val === 'object') return stringifyObject(val)
910
}

test/ascii-data-table-test.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,16 @@ describe('Ascii Tables', () => {
2222
})
2323

2424
it('should generate a simple table', () => {
25-
const items = [['x'], ['a']]
25+
const items = [['x'], ['a'], [true]]
2626
const res = AsciiTable.run(items)
2727
expect(res).toBe([
28-
'+===+',
29-
'|x |',
30-
'+===+',
31-
'|a |',
32-
'+---+'].join('\n')
28+
'+====+',
29+
'|x |',
30+
'+====+',
31+
'|a |',
32+
'+----+',
33+
'|true|',
34+
'+----+'].join('\n')
3335
)
3436
})
3537

0 commit comments

Comments
 (0)