Skip to content

Commit 1984deb

Browse files
committedNov 10, 2019
fix: typecheck type and tag before normalize
1 parent 09e7b10 commit 1984deb

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed
 

‎src/consola.js

+2-6
Original file line numberDiff line numberDiff line change
@@ -251,12 +251,8 @@ class Consola {
251251
}
252252

253253
// Normalize type and tag to lowercase
254-
if (logObj.type) {
255-
logObj.type = logObj.type.toLowerCase()
256-
}
257-
if (logObj.tag) {
258-
logObj.tag = logObj.tag.toLowerCase()
259-
}
254+
logObj.type = typeof logObj.type === 'string' ? logObj.type.toLowerCase() : ''
255+
logObj.tag = typeof logObj.tag === 'string' ? logObj.tag.toLowerCase() : ''
260256

261257
// Throttle
262258
const diffTime = this._lastLogTime ? logObj.date - this._lastLogTime : 0

0 commit comments

Comments
 (0)
Please sign in to comment.