Skip to content

Commit

Permalink
Fix: nat in option storage diff (#566)
Browse files Browse the repository at this point in the history
  • Loading branch information
aopoltorzhicky authored Oct 21, 2023
1 parent 1dc4646 commit ef4e6fb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .env.development
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
NODE_ENV=development
VUE_APP_API_URI=https://hope.better-call.dev/v1
VUE_APP_API_URI=https://api.better-call.dev/v1
VUE_APP_IPFS_NODE=https://cloudflare-ipfs.com/
VUE_APP_SEARCH_SERVICE_URI=https://search.dipdup.net
VUE_APP_TOKEN_METADATA_API=https://metadata.dipdup.net
Expand Down
4 changes: 2 additions & 2 deletions src/utils/diff.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function formatValue(val, typ) {
}

function formatInt(x) {
return x.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
return x ? x.replace(/\B(?=(\d{3})+(?!\d))/g, ",") : '0';
}

function getValue(x) {
Expand All @@ -48,7 +48,7 @@ function valueDiff(x) {
if (!x.type) return '';

if (x.type === 'nat' || x.type === 'int') {
let value = parseInt(x.value, 10) - parseInt(x.from, 10);
let value = parseInt(x.value, 10) - parseInt(x.from ? x.from : 0, 10);
return ` (${value > 0 ? '+' : ''}${value.toLocaleString(undefined)})`
} else if (x.type === 'timestamp') {
let from = parseTimestamp(x.from);
Expand Down

0 comments on commit ef4e6fb

Please sign in to comment.