diff options
author | Olaf Tomalka <olaf@tomalka.me> | 2018-01-05 09:07:25 +0800 |
---|---|---|
committer | Olaf Tomalka <olaf@tomalka.me> | 2018-01-05 19:48:17 +0800 |
commit | e019ae4aed610c4645894c2999871fd3c0b57388 (patch) | |
tree | c9acc3f7a1dbccaf10c8616289de61f2dc879236 /packages/abi-gen/src | |
parent | f3b8bac47787a13ea4360b992bbe550bec2c3e19 (diff) | |
download | dexon-0x-contracts-e019ae4aed610c4645894c2999871fd3c0b57388.tar.gz dexon-0x-contracts-e019ae4aed610c4645894c2999871fd3c0b57388.tar.zst dexon-0x-contracts-e019ae4aed610c4645894c2999871fd3c0b57388.zip |
Changes to abi-gen after code review
* Added change to CHANGELOG
* Renamed variable and context to ctor to avoid keyword
* Used lodash' isUndefined to better check ctor
Diffstat (limited to 'packages/abi-gen/src')
-rw-r--r-- | packages/abi-gen/src/index.ts | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/packages/abi-gen/src/index.ts b/packages/abi-gen/src/index.ts index 65dc1c607..527af32b1 100644 --- a/packages/abi-gen/src/index.ts +++ b/packages/abi-gen/src/index.ts @@ -76,9 +76,9 @@ for (const abiFileName of abiFileNames) { process.exit(1); } - let constructor = ABI.find((abi: Web3.AbiDefinition) => abi.type === ABI_TYPE_CONSTRUCTOR) as Web3.ConstructorAbi; - if (!constructor) { - constructor = utils.getEmptyConstructor(); // The constructor exists, but it's implicit in JSON's ABI definition + let ctor = ABI.find((abi: Web3.AbiDefinition) => abi.type === ABI_TYPE_CONSTRUCTOR) as Web3.ConstructorAbi; + if (_.isUndefined(ctor)) { + ctor = utils.getEmptyConstructor(); // The constructor exists, but it's implicit in JSON's ABI definition } const methodAbis = ABI.filter((abi: Web3.AbiDefinition) => abi.type === ABI_TYPE_METHOD) as Web3.MethodAbi[]; @@ -101,7 +101,7 @@ for (const abiFileName of abiFileNames) { const contextData = { contractName: namedContent.name, - constructor, + ctor, methods: methodsData, events: eventAbis, }; |