Comparing version 0.0.0 to 0.0.1
@@ -337,3 +337,22 @@ (function(g,f){typeof exports==='object'&&typeof module!=='undefined'?f(exports):typeof define==='function'&&define.amd?define(['exports'],f):(g=typeof globalThis!=='undefined'?globalThis:g||self,f(g.Ansa={}));})(this,(function(exports){'use strict';function _regeneratorRuntime() { | ||
"Economia": "Economia", | ||
"Abruzzo": "Abruzzo" | ||
"Abruzzo": "Abruzzo", | ||
"Basilicata": "Basilicata", | ||
"Calabria": "Calabria", | ||
"Campania": "Campania", | ||
"Emilia_Romagna": "Emilia Romagna", | ||
"Friuli_Venezia_Giulia": "Friuli Venezia Giulia", | ||
"Lazio": "Lazio", | ||
"Liguria": "Liguria", | ||
"Lombardia": "Lombardia", | ||
"Marche": "Marche", | ||
"Molise": "Molise", | ||
"Piemonte": "Piemonte", | ||
"Puglia": "Puglia", | ||
"Sardegna": "Sardegna", | ||
"Sicilia": "Sicilia", | ||
"Toscana": "Toscana", | ||
"Trentino_Alto_Adige": "Trentino", | ||
"Umbria": "Umbria", | ||
"Valle_D_Aosta": "Valle Aosta", | ||
"Veneto": "Veneto" | ||
}; | ||
@@ -346,17 +365,11 @@ var getNews = /*#__PURE__*/function () { | ||
case 0: | ||
if (CATEGORIES[category]) { | ||
_context.next = 2; | ||
break; | ||
} | ||
throw new Error("Category does not exists"); | ||
_context.next = 2; | ||
return fetch("https://raw.githubusercontent.com/astagi/ansa-news/develop/json/".concat(category, ".json")); | ||
case 2: | ||
_context.next = 4; | ||
return fetch("https://raw.githubusercontent.com/astagi/ansa-news/develop/json/".concat(category, ".json")); | ||
case 4: | ||
response = _context.sent; | ||
_context.next = 7; | ||
_context.next = 5; | ||
return response.json(); | ||
case 7: | ||
case 5: | ||
return _context.abrupt("return", _context.sent); | ||
case 8: | ||
case 6: | ||
case "end": | ||
@@ -363,0 +376,0 @@ return _context.stop(); |
24
index.js
@@ -7,9 +7,25 @@ const CATEGORIES = { | ||
"Economia": "Economia", | ||
"Abruzzo": "Abruzzo" | ||
"Abruzzo": "Abruzzo", | ||
"Basilicata": "Basilicata", | ||
"Calabria": "Calabria", | ||
"Campania": "Campania", | ||
"Emilia_Romagna": "Emilia Romagna", | ||
"Friuli_Venezia_Giulia": "Friuli Venezia Giulia", | ||
"Lazio": "Lazio", | ||
"Liguria": "Liguria", | ||
"Lombardia": "Lombardia", | ||
"Marche": "Marche", | ||
"Molise": "Molise", | ||
"Piemonte": "Piemonte", | ||
"Puglia": "Puglia", | ||
"Sardegna": "Sardegna", | ||
"Sicilia": "Sicilia", | ||
"Toscana": "Toscana", | ||
"Trentino_Alto_Adige": "Trentino", | ||
"Umbria": "Umbria", | ||
"Valle_D_Aosta": "Valle Aosta", | ||
"Veneto": "Veneto" | ||
} | ||
const getNews = async (category) => { | ||
if (!CATEGORIES[category]) { | ||
throw new Error("Category does not exists") | ||
} | ||
const response = await fetch(`https://raw.githubusercontent.com/astagi/ansa-news/develop/json/${category}.json`) | ||
@@ -16,0 +32,0 @@ return await response.json() |
{ | ||
"name": "ansa", | ||
"version": "0.0.0", | ||
"version": "0.0.1", | ||
"description": "News from ANSA", | ||
@@ -5,0 +5,0 @@ "main": "bundle.js", |
18277
415