diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-11-13 07:55:42 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-11-13 09:06:14 +0800 |
commit | 7b50a6490db820b4e7f7b972ae0dcb602e5118b6 (patch) | |
tree | 62ae0c172b5dfa26810b19ca51b0594850e838bb /src/stores | |
parent | fdb82d5dd4ea14e35ee03cf9abca6105fa1e0595 (diff) | |
download | dexon-sol-tools-7b50a6490db820b4e7f7b972ae0dcb602e5118b6.tar dexon-sol-tools-7b50a6490db820b4e7f7b972ae0dcb602e5118b6.tar.gz dexon-sol-tools-7b50a6490db820b4e7f7b972ae0dcb602e5118b6.tar.bz2 dexon-sol-tools-7b50a6490db820b4e7f7b972ae0dcb602e5118b6.tar.lz dexon-sol-tools-7b50a6490db820b4e7f7b972ae0dcb602e5118b6.tar.xz dexon-sol-tools-7b50a6490db820b4e7f7b972ae0dcb602e5118b6.tar.zst dexon-sol-tools-7b50a6490db820b4e7f7b972ae0dcb602e5118b6.zip |
Don't store empty objects
Diffstat (limited to 'src/stores')
-rw-r--r-- | src/stores/balance_proxy_allowance_lazy_store.ts | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/stores/balance_proxy_allowance_lazy_store.ts b/src/stores/balance_proxy_allowance_lazy_store.ts index 5c54fbb3b..c83e61606 100644 --- a/src/stores/balance_proxy_allowance_lazy_store.ts +++ b/src/stores/balance_proxy_allowance_lazy_store.ts @@ -44,6 +44,9 @@ export class BalanceAndProxyAllowanceLazyStore { public deleteBalance(tokenAddress: string, userAddress: string): void { if (!_.isUndefined(this.balance[tokenAddress])) { delete this.balance[tokenAddress][userAddress]; + if (_.isEmpty(this.balance[tokenAddress])) { + delete this.balance[tokenAddress]; + } } } public async getProxyAllowanceAsync(tokenAddress: string, userAddress: string): Promise<BigNumber> { @@ -67,6 +70,9 @@ export class BalanceAndProxyAllowanceLazyStore { public deleteProxyAllowance(tokenAddress: string, userAddress: string): void { if (!_.isUndefined(this.proxyAllowance[tokenAddress])) { delete this.proxyAllowance[tokenAddress][userAddress]; + if (_.isEmpty(this.proxyAllowance[tokenAddress])) { + delete this.proxyAllowance[tokenAddress]; + } } } public deleteAll(): void { |