fix crash
This commit is contained in:
@@ -23,14 +23,17 @@ export const getfuzzworkPrices: PriceGetter = async types => {
|
|||||||
return (await Promise.all(batches))
|
return (await Promise.all(batches))
|
||||||
.flatMap(b => Object.entries(b.data))
|
.flatMap(b => Object.entries(b.data))
|
||||||
.map(entry => {
|
.map(entry => {
|
||||||
const id = parseInt(entry[0]);
|
const id = doParseInt(entry[0]);
|
||||||
const prices = entry[1] as any;
|
const prices = entry[1] as any;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
type: types.find(t => t.id === id) as MarketType,
|
type: types.find(t => t.id === id) as MarketType,
|
||||||
buy: parseFloat(prices.buy.max),
|
buy: doParseFloat(prices?.buy?.max),
|
||||||
sell: parseFloat(prices.sell.min),
|
sell: doParseFloat(prices?.sell?.min),
|
||||||
orderCount: parseInt(prices.buy.order_count) + parseInt(prices.sell.order_count)
|
orderCount: doParseInt(prices?.buy?.order_count) + doParseInt(prices?.sell?.order_count)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const doParseInt = (s?: string) => s ? parseInt(s) : 0;
|
||||||
|
const doParseFloat = (s?: string) => s ? parseFloat(s) : 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user