MCPcopy Create free account
hub / github.com/ExodusOSS/cryptocompare / fetchJSON

Function fetchJSON

index.js:11–31  ·  view source on GitHub ↗
(url)

Source from the content-addressed store, hash-verified

9}
10
11function fetchJSON (url) {
12 if (apiKey !== '') {
13 if (url.indexOf('?') > -1) {
14 url += '&api_key='
15 } else {
16 url += '?api_key='
17 }
18 url += apiKey
19 }
20 return fetch(url)
21 .then(res => {
22 if (!res.ok) {
23 throw new Error(`${res.status} ${res.statusText}`)
24 }
25 return res.json()
26 })
27 .then(body => {
28 if (body.Response === 'Error') throw body.Message
29 return body
30 })
31}
32
33function coinList () {
34 const url = `${baseUrl}all/coinlist`

Callers 15

coinListFunction · 0.85
exchangeListFunction · 0.85
constituentExchangeListFunction · 0.85
newsFeedsAndCategoriesFunction · 0.85
newsListFunction · 0.85
priceFunction · 0.85
priceMultiFunction · 0.85
priceFullFunction · 0.85
priceHistoricalFunction · 0.85
generateAvgFunction · 0.85
topPairsFunction · 0.85
topExchangesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected