Changed remaining instances of implicit bool casts to explicit lodash calls

This commit is contained in:
Greg Hysen
2018-11-27 13:35:39 -08:00
parent 1f693ea121
commit ffb8b0a619
3 changed files with 6 additions and 5 deletions

View File

@@ -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);

View File

@@ -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('');

View File

@@ -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;
}