aboutsummaryrefslogtreecommitdiffstats
path: root/packages/utils/src
diff options
context:
space:
mode:
authorGreg Hysen <greg.hysen@gmail.com>2018-11-28 05:35:39 +0800
committerGreg Hysen <greg.hysen@gmail.com>2018-11-29 08:38:11 +0800
commitffb8b0a619be3b8fb30a6acc99f590a6b40d49e1 (patch)
tree3352f0c5617f6b49bd17d0e33cc2e64973a63a38 /packages/utils/src
parent1f693ea12142bc761f4067871d92e7d2662cf256 (diff)
downloaddexon-sol-tools-ffb8b0a619be3b8fb30a6acc99f590a6b40d49e1.tar
dexon-sol-tools-ffb8b0a619be3b8fb30a6acc99f590a6b40d49e1.tar.gz
dexon-sol-tools-ffb8b0a619be3b8fb30a6acc99f590a6b40d49e1.tar.bz2
dexon-sol-tools-ffb8b0a619be3b8fb30a6acc99f590a6b40d49e1.tar.lz
dexon-sol-tools-ffb8b0a619be3b8fb30a6acc99f590a6b40d49e1.tar.xz
dexon-sol-tools-ffb8b0a619be3b8fb30a6acc99f590a6b40d49e1.tar.zst
dexon-sol-tools-ffb8b0a619be3b8fb30a6acc99f590a6b40d49e1.zip
Changed remaining instances of implicit `bool` casts to explicit lodash calls
Diffstat (limited to 'packages/utils/src')
-rw-r--r--packages/utils/src/abi_encoder/abstract_data_types/types/pointer.ts2
-rw-r--r--packages/utils/src/abi_encoder/calldata/blocks/set.ts4
-rw-r--r--packages/utils/src/abi_encoder/evm_data_type_factory.ts5
3 files changed, 6 insertions, 5 deletions
diff --git a/packages/utils/src/abi_encoder/abstract_data_types/types/pointer.ts b/packages/utils/src/abi_encoder/abstract_data_types/types/pointer.ts
index 46e60979a..dc9de8a3d 100644
--- a/packages/utils/src/abi_encoder/abstract_data_types/types/pointer.ts
+++ b/packages/utils/src/abi_encoder/abstract_data_types/types/pointer.ts
@@ -21,7 +21,7 @@ export abstract class Pointer extends DataType {
}
public generateCalldataBlock(value: any, parentBlock?: CalldataBlock): CalldataBlocks.Pointer {
- if (!parentBlock) {
+ if (_.isUndefined(parentBlock)) {
throw new Error(`DependentDataType requires a parent block to generate its block`);
}
const destinationBlock = this._destination.generateCalldataBlock(value, parentBlock);
diff --git a/packages/utils/src/abi_encoder/calldata/blocks/set.ts b/packages/utils/src/abi_encoder/calldata/blocks/set.ts
index e4de22c5c..81455b364 100644
--- a/packages/utils/src/abi_encoder/calldata/blocks/set.ts
+++ b/packages/utils/src/abi_encoder/calldata/blocks/set.ts
@@ -14,7 +14,7 @@ export class Set extends CalldataBlock {
public getRawData(): Buffer {
const rawDataComponents: Buffer[] = [];
- if (this._header) {
+ if (!_.isUndefined(this._header)) {
rawDataComponents.push(this._header);
}
_.each(this._members, (member: CalldataBlock) => {
@@ -35,7 +35,7 @@ export class Set extends CalldataBlock {
}
public toBuffer(): Buffer {
- if (this._header) {
+ if (!_.isUndefined(this._header)) {
return this._header;
}
return new Buffer('');
diff --git a/packages/utils/src/abi_encoder/evm_data_type_factory.ts b/packages/utils/src/abi_encoder/evm_data_type_factory.ts
index bfe457367..16a0b724d 100644
--- a/packages/utils/src/abi_encoder/evm_data_type_factory.ts
+++ b/packages/utils/src/abi_encoder/evm_data_type_factory.ts
@@ -2,6 +2,7 @@
/* tslint:disable max-classes-per-file */
/* tslint:disable no-construct */
import { DataItem, MethodAbi } from 'ethereum-types';
+import * as _ from 'lodash';
import { DataType, DataTypeFactory } from './abstract_data_types';
import * as Impl from './evm_data_types';
@@ -105,9 +106,9 @@ export class EvmDataTypeFactory implements DataTypeFactory {
dataType = new String(dataItem);
}
// @TODO: Implement Fixed/UFixed types
- if (!dataType) {
+ if (_.isUndefined(dataType)) {
throw new Error(`Unrecognized data type: '${dataItem.type}'`);
- } else if (parentDataType && !dataType.isStatic()) {
+ } else if (!_.isUndefined(parentDataType) && !dataType.isStatic()) {
const pointerToDataType = new Pointer(dataType, parentDataType);
return pointerToDataType;
}