Skip to content

Commit

Permalink
fix(stringify): improve types to get full coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
bitjson committed Mar 11, 2020
1 parent 3842373 commit c4359d5
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/lib/format/log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ export const stringify = (value: any, spacing = defaultStringifySpacing) =>
// eslint-disable-next-line complexity
(_, item) => {
const type = typeof item;
const name =
type === 'object' ? (item.constructor?.name as string) : type;
const name = type === 'object' ? (item as object).constructor.name : type;
switch (name) {
case 'Uint8Array':
return `<Uint8Array: 0x${binToHex(item as Uint8Array)}>`;
Expand All @@ -40,7 +39,6 @@ export const stringify = (value: any, spacing = defaultStringifySpacing) =>
case 'function':
case 'symbol':
return `<${name}: ${(item as symbol | Function).toString()}>`;

default:
return item;
}
Expand Down

0 comments on commit c4359d5

Please sign in to comment.