From 3895553e88c60a9a272c9476138cd417496a6b33 Mon Sep 17 00:00:00 2001 From: bumi Date: Thu, 26 Apr 2018 10:23:27 +0200 Subject: [PATCH] Use destructuring for options This makes it more readable what options are used --- lib/kredits.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/kredits.js b/lib/kredits.js index b0aa7f7..541d362 100644 --- a/lib/kredits.js +++ b/lib/kredits.js @@ -23,14 +23,15 @@ function capitalize(word) { class Kredits { constructor(provider, signer, options = {}) { + let { addresses, abis, ipfsConfig } = options; + this.provider = provider; this.signer = signer; - // by default we only need the registry address. // the rest is loaded from there in the init() function - this.addresses = options['addresses'] || { Registry: RegistryAddress[this.provider.chainId.toString()] }; // chaiID must be a string - this.abis = options['abis'] || ABIS; - this.ipfs = new IPFS(options['ipfsConfig']); + this.addresses = addresses || { Registry: RegistryAddress[this.provider.chainId.toString()] }; // chaiID must be a string + this.abis = abis || ABIS; + this.ipfs = new IPFS(ipfsConfig); this.contracts = {}; }