Adjust encoder/decoder fallbacks (#750)

* Adjust encoder/decoder fallbacks

* Dep-dup is functions

* Complexity cleanups
This commit is contained in:
Jaco Greeff
2020-11-08 11:20:22 +01:00
committed by GitHub
parent e1aa096cef
commit c67c1966d7
18 changed files with 118 additions and 78 deletions
+3 -7
View File
@@ -35,11 +35,7 @@ export default function formatElapsed <ExtToBn extends ToBn> (now?: Date | null,
const tsNow = (now && now.getTime()) || 0;
const tsValue = getValue(value || 0);
if (tsNow && tsValue) {
const elapsed = Math.max(Math.abs(tsNow - tsValue), 0) / 1000;
return formatValue(elapsed);
}
return '0.0s';
return (tsNow && tsValue)
? formatValue(Math.max(Math.abs(tsNow - tsValue), 0) / 1000)
: '0.0s';
}