Skip to content

Commit d2402af

Browse files
committed
fix: handle null value of obj for assignToLogObj
1 parent f5acb3c commit d2402af

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/consola.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,7 @@ export default class Consola {
7373
}
7474
} else {
7575
// [obj]
76-
if (typeof arg1 === 'object') {
77-
assignToLogObj(logObj, arg1)
78-
}
76+
assignToLogObj(logObj, arg1)
7977
}
8078

8179
// Log

src/utils.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ const VALID_LOGOBJ_KEYS = [
44
]
55

66
export function assignToLogObj (logObj, obj) {
7+
if (typeof obj !== 'object') {
8+
return
9+
}
710
for (const key of VALID_LOGOBJ_KEYS) {
811
const val = obj[key]
912
if (typeof val !== 'undefined') {

0 commit comments

Comments
 (0)