getStyle = {
const url = style.replace('mapbox://styles/','')
const response = await fetch(`https://api.mapbox.com/styles/v1/${url}?access_token=${accessToken}`)
const json = await response.json()
if (json.message === 'Not Found') return {data: 'Not Found'}
if (json.message === 'Style not found') return {data: 'Style Not Found'}
const data = json.layers.reduce(
( acc, currentValue ) => {
const { id, minzoom, type, paint } = currentValue;
console.log(currentValue.paint['line-color']);
return ["line"].indexOf(type)!== 0 ? acc : acc.concat(
extractWidths(paint['line-width'] || 1, id, minzoom || 0, currentValue.paint['line-color'])
)
},
[]
)
return data
}