Skip to content

Commit

Permalink
Simplify switch statement (#550)
Browse files Browse the repository at this point in the history
Both the 'undefined' and 'function' cases can be handled in the same way.
  • Loading branch information
nwoltman authored and mcollina committed Nov 22, 2018
1 parent 3b7019e commit 155d75e
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lib/tools.js
Expand Up @@ -108,7 +108,9 @@ function asJson (obj, msg, num, time) {
value = serializers[key] ? serializers[key](value) : value

switch (typeof value) {
case 'undefined': continue
case 'undefined':
case 'function':
continue
case 'number':
/* eslint no-fallthrough: "off" */
if (Number.isFinite(value) === false) {
Expand All @@ -122,10 +124,6 @@ function asJson (obj, msg, num, time) {
case 'string':
value = (stringifiers[key] || asString)(value)
break
case 'function':
// ignore functions
value = undefined
break
default:
value = (stringifiers[key] || stringify)(value)
}
Expand Down

0 comments on commit 155d75e

Please sign in to comment.