My code :
export const convertToTickerObject = (data) => {
const keys = [
'id',
'last',
'lowestAsk',
'highestBid',
'percentChange',
'baseVolume',
'quoteVolume',
'isFrozen',
'high24hr',
'low24hr'
];
const object = {};
data.forEach((value, i) => {
if (i === 0) {
object.name = getCurrencyPairId(value);
return; //escape arrow function
}
const key = keys[i];
object[key] = value;
});
return object;
};
Error:
UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'forEach' of undefined UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:7188) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
I try use async/await, but this warning continuously occured.
How can I solve this warning ? :(