Skip to content

Commit

Permalink
fix: handle null value of obj for assignToLogObj
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Oct 5, 2018
1 parent f5acb3c commit d2402af
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 1 addition & 3 deletions src/consola.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,7 @@ export default class Consola {
}
} else {
// [obj]
if (typeof arg1 === 'object') {
assignToLogObj(logObj, arg1)
}
assignToLogObj(logObj, arg1)
}

// Log
Expand Down
3 changes: 3 additions & 0 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ const VALID_LOGOBJ_KEYS = [
]

export function assignToLogObj (logObj, obj) {
if (typeof obj !== 'object') {
return
}
for (const key of VALID_LOGOBJ_KEYS) {
const val = obj[key]
if (typeof val !== 'undefined') {
Expand Down

0 comments on commit d2402af

Please sign in to comment.