Skip to content
This repository has been archived by the owner on Apr 15, 2019. It is now read-only.

Fix tablify object #548

Merged
merged 2 commits into from
Jun 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/utils/tablify.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const chars = {
};

const getKeyValueObject = object => {
if (typeof object !== 'object') {
if (!object || typeof object !== 'object') {
return object;
}
return Object.entries(object)
Expand Down
1 change: 1 addition & 0 deletions test/steps/general/1_given.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export function aNonEmptyObject() {
export function aDeeplyNestedObject() {
this.test.ctx.testObject = {
root: 'value',
nullObject: null,
nested: {
object: 'values',
testing: 123,
Expand Down
2 changes: 1 addition & 1 deletion test/steps/printing/3_then.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export function theReturnedTableShouldHaveARowWithTheObjectKeyAndStringifiedNest
const { returnValue, testObject } = this.test.ctx;
return Object.entries(testObject).forEach(([key, value], arrayKey) => {
const strValue =
typeof value === 'object'
typeof value === 'object' && value !== null
? Object.entries(value)
.map(
([vKey, vValue]) =>
Expand Down