From f2e5fd88469c9e3396197b42298d0b2de8a4d47c Mon Sep 17 00:00:00 2001 From: fragosti Date: Mon, 15 Oct 2018 18:07:19 -0700 Subject: Add ts-optchain and use it instead of lodash get --- packages/instant/src/components/order_details.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'packages/instant/src/components') diff --git a/packages/instant/src/components/order_details.tsx b/packages/instant/src/components/order_details.tsx index bd31bfba8..a15ff411b 100644 --- a/packages/instant/src/components/order_details.tsx +++ b/packages/instant/src/components/order_details.tsx @@ -2,6 +2,7 @@ import { BuyQuoteInfo } from '@0xproject/asset-buyer'; import { BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; import * as React from 'react'; +import { oc } from 'ts-optchain'; import { ColorOption } from '../style/theme'; import { format } from '../util/format'; @@ -16,9 +17,10 @@ export interface OrderDetailsProps { export class OrderDetails extends React.Component { public render(): React.ReactNode { const { buyQuoteInfo, ethUsdPrice } = this.props; - const ethAssetPrice = _.get(buyQuoteInfo, 'ethPerAssetPrice'); - const ethTokenFee = _.get(buyQuoteInfo, 'feeEthAmount'); - const totalEthAmount = _.get(buyQuoteInfo, 'totalEthAmount'); + const buyQuoteAccessor = oc(buyQuoteInfo); + const ethAssetPrice = buyQuoteAccessor.ethPerAssetPrice(); + const ethTokenFee = buyQuoteAccessor.feeEthAmount(); + const totalEthAmount = buyQuoteAccessor.totalEthAmount(); return ( -- cgit v1.2.3