Skip to content

Commit

Permalink
capitalize first letter of unit and frequency properties
Browse files Browse the repository at this point in the history
  • Loading branch information
TETatenda committed Jul 10, 2024
1 parent 4610131 commit 792b3c9
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion tradingeconomics/marketSnap.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,23 @@ function getMarketSnap(){
if(category != null){
url = '/markets/search/' + search_term + '?c=' + apikey + '&category=' + category ;
}

if (url === '') throw new Error('Missing parameters.');

if (url.includes(category || cross)){
Data = url_base + url .replace (' ','%20');
}else{
Data = url_base + url + '?c=' + apikey.replace (' ','%20');
}
return func.makeTheRequest(Data)

let result = func.makeTheRequest(Data).then(data => {
data.map(obj => {
delete Object.assign(obj, {['Unit']: obj['unit'] })['unit'];
delete Object.assign(obj, {['Frequency']: obj['frequency'] })['frequency'];
})
return data
})
return result
// return fetch(Data)
// .then(func.handleErrors)
// .then(function(response) {
Expand Down

0 comments on commit 792b3c9

Please sign in to comment.