diff options
author | fragosti <francesco.agosti93@gmail.com> | 2018-10-27 01:11:42 +0800 |
---|---|---|
committer | fragosti <francesco.agosti93@gmail.com> | 2018-10-27 01:24:50 +0800 |
commit | 3206e1528b1f9924f3bfc191268304731448557f (patch) | |
tree | 96664f38e5456dc037f283faf9941759729e4842 /packages/instant/src/index.umd.ts | |
parent | 27d9e516e1cf6a8bea469998bc92513bec3d91c5 (diff) | |
download | dexon-sol-tools-3206e1528b1f9924f3bfc191268304731448557f.tar dexon-sol-tools-3206e1528b1f9924f3bfc191268304731448557f.tar.gz dexon-sol-tools-3206e1528b1f9924f3bfc191268304731448557f.tar.bz2 dexon-sol-tools-3206e1528b1f9924f3bfc191268304731448557f.tar.lz dexon-sol-tools-3206e1528b1f9924f3bfc191268304731448557f.tar.xz dexon-sol-tools-3206e1528b1f9924f3bfc191268304731448557f.tar.zst dexon-sol-tools-3206e1528b1f9924f3bfc191268304731448557f.zip |
feat: add assertions to render method
Diffstat (limited to 'packages/instant/src/index.umd.ts')
-rw-r--r-- | packages/instant/src/index.umd.ts | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/packages/instant/src/index.umd.ts b/packages/instant/src/index.umd.ts index f648b37f2..dabd45cae 100644 --- a/packages/instant/src/index.umd.ts +++ b/packages/instant/src/index.umd.ts @@ -1,9 +1,22 @@ +import * as _ from 'lodash'; import * as React from 'react'; import * as ReactDOM from 'react-dom'; import { DEFAULT_ZERO_EX_CONTAINER_SELECTOR } from './constants'; import { ZeroExInstant, ZeroExInstantProps } from './index'; +import { assert } from './util/assert'; export const render = (props: ZeroExInstantProps, selector: string = DEFAULT_ZERO_EX_CONTAINER_SELECTOR) => { + assert.isHexString('assetData', props.assetData); + assert.isValidLiquiditySource('liquiditySource', props.liquiditySource); + if (!_.isUndefined(props.additionalAssetMetaDataMap)) { + assert.isValidAssetMetaDataMap('additionalAssetMetaDataMap', props.additionalAssetMetaDataMap); + } + if (!_.isUndefined(props.defaultAssetBuyAmount)) { + assert.isNumber('defaultAssetBuyAmount', props.defaultAssetBuyAmount); + } + if (!_.isUndefined(props.networkId)) { + assert.isNumber('networkId', props.networkId); + } ReactDOM.render(React.createElement(ZeroExInstant, props), document.querySelector(selector)); }; |