Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce size? #29

Open
simplenotezy opened this issue Feb 15, 2020 · 4 comments
Open

Reduce size? #29

simplenotezy opened this issue Feb 15, 2020 · 4 comments

Comments

@simplenotezy
Copy link

Could we somehow reduce the size of this library? It's 179kb -- compared to vue itself which is 64 kb.

@gehrj
Copy link
Owner

gehrj commented Feb 19, 2020

@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.

@MartinsOnuoha
Copy link

MartinsOnuoha commented Mar 26, 2020

@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?

an API like this

@gehrj
Copy link
Owner

gehrj commented Apr 10, 2020

@MartinsOnuoha I will look into this

@abr4xas
Copy link
Contributor

abr4xas commented Oct 25, 2020

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"
      }
    ]
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants