Open simplenotezy opened 4 years ago
@simplenotezy I can try and look into this, the size is so large due to the amount of countries and regions supported. The array of objects being taken in is pretty massive.
@gehrj perhaps you could use Axios
as a peer dependency to pull the data from an opensource API since Axios
is just about 15.4kb?
@MartinsOnuoha I will look into this
IMO, make a ajax request only because "its to heavy" is stupid. I think that https://restcountries.eu gives to much info:
// restcountries
{
"name": "Afghanistan",
"topLevelDomain": [
".af"
],
"alpha2Code": "AF",
"alpha3Code": "AFG",
"callingCodes": [
"93"
],
"capital": "Kabul",
"altSpellings": [
"AF",
"Afġānistān"
],
"region": "Asia",
"subregion": "Southern Asia",
"population": 27657145,
"latlng": [
33,
65
],
"demonym": "Afghan",
"area": 652230,
"gini": 27.8,
"timezones": [
"UTC+04:30"
],
"borders": [
"IRN",
"PAK",
"TKM",
"UZB",
"TJK",
"CHN"
],
"nativeName": "افغانستان",
"numericCode": "004",
"currencies": [
{
"code": "AFN",
"name": "Afghan afghani",
"symbol": "؋"
}
],
"languages": [
{
"iso639_1": "ps",
"iso639_2": "pus",
"name": "Pashto",
"nativeName": "پښتو"
},
{
"iso639_1": "uz",
"iso639_2": "uzb",
"name": "Uzbek",
"nativeName": "Oʻzbek"
},
{
"iso639_1": "tk",
"iso639_2": "tuk",
"name": "Turkmen",
"nativeName": "Türkmen"
}
],
"translations": {
"de": "Afghanistan",
"es": "Afganistán",
"fr": "Afghanistan",
"ja": "アフガニスタン",
"it": "Afghanistan",
"br": "Afeganistão",
"pt": "Afeganistão",
"nl": "Afghanistan",
"hr": "Afganistan",
"fa": "افغانستان"
},
"flag": "https://restcountries.eu/data/afg.svg",
"regionalBlocs": [
{
"acronym": "SAARC",
"name": "South Asian Association for Regional Cooperation",
"otherAcronyms": [],
"otherNames": []
}
],
"cioc": "AFG"
}
// this package
{
"countryName": "Afghanistan",
"countryShortCode": "AF",
"regions": [
{
"name": "Badakhshan",
"shortCode": "BDS"
},
{
"name": "Badghis",
"shortCode": "BDG"
},
{
"name": "Baghlan",
"shortCode": "BGL"
},
{
"name": "Balkh",
"shortCode": "BAL"
},
{
"name": "Bamyan",
"shortCode": "BAM"
},
{
"name": "Daykundi",
"shortCode": "DAY"
},
{
"name": "Farah",
"shortCode": "FRA"
},
{
"name": "Faryab",
"shortCode": "FYB"
},
{
"name": "Ghazni",
"shortCode": "GHA"
},
{
"name": "Ghor",
"shortCode": "GHO"
},
{
"name": "Helmand",
"shortCode": "HEL"
},
{
"name": "Herat",
"shortCode": "HER"
},
{
"name": "Jowzjan",
"shortCode": "JOW"
},
{
"name": "Kabul",
"shortCode": "KAB"
},
{
"name": "Kandahar",
"shortCode": "KAN"
},
{
"name": "Kapisa",
"shortCode": "KAP"
},
{
"name": "Khost",
"shortCode": "KHO"
},
{
"name": "Kunar",
"shortCode": "KNR"
},
{
"name": "Kunduz",
"shortCode": "KDZ"
},
{
"name": "Laghman",
"shortCode": "LAG"
},
{
"name": "Logar",
"shortCode": "LOW"
},
{
"name": "Maidan Wardak",
"shortCode": "WAR"
},
{
"name": "Nangarhar",
"shortCode": "NAN"
},
{
"name": "Nimruz",
"shortCode": "NIM"
},
{
"name": "Nuristan",
"shortCode": "NUR"
},
{
"name": "Paktia",
"shortCode": "PIA"
},
{
"name": "Paktika",
"shortCode": "PKA"
},
{
"name": "Panjshir",
"shortCode": "PAN"
},
{
"name": "Parwan",
"shortCode": "PAR"
},
{
"name": "Samangan",
"shortCode": "SAM"
},
{
"name": "Sar-e Pol",
"shortCode": "SAR"
},
{
"name": "Takhar",
"shortCode": "TAK"
},
{
"name": "Urozgan",
"shortCode": "ORU"
},
{
"name": "Zabul",
"shortCode": "ZAB"
}
]
}
Could we somehow reduce the size of this library? It's 179kb -- compared to vue itself which is 64 kb.