Skip to content

Commit

Permalink
Merge pull request #56 from jav7zaid/add-landlocked-cntr
Browse files Browse the repository at this point in the history
Added 'is_landlocked' property
  • Loading branch information
sthiepaan committed Oct 24, 2020
2 parents a747bed + c342236 commit 820e1f3
Show file tree
Hide file tree
Showing 4 changed files with 1,141 additions and 849 deletions.
97 changes: 69 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,17 @@ This section contains nt to _contribute_ to open source? Try solving our issues
"currency": "afghani",
"native_language": ["dari persian", "pashto"],
"famous_for": "rugs, taliban",
"phone_code": "+93",
"flag": "https://flagpedia.net/data/flags/h80/af.png"
"phone_code": "+93",
"flag": "https://flagpedia.net/data/flags/h80/af.png"
},
{
"country": "albania",
"capital": "tirane",
"currency": "lek",
"native_language": ["albanian"],
"famous_for" : "mother teresa",
"phone_code": "+355",
"flag": "https://flagpedia.net/data/flags/h80/al.png"
"phone_code": "+355",
"flag": "https://flagpedia.net/data/flags/h80/al.png"
},
...
]
Expand Down Expand Up @@ -120,8 +120,8 @@ This section contains nt to _contribute_ to open source? Try solving our issues
currency: "indian rupee",
native_language: ["hindi", "english"],
famous_for: "bollywood, yoga, hinduism, food and diversity",
phone_code: "+91",
flag: "https://flagpedia.net/data/flags/h80/in.png"
phone_code: "+91",
flag: "https://flagpedia.net/data/flags/h80/in.png"
},
];
```
Expand All @@ -140,8 +140,8 @@ This section contains nt to _contribute_ to open source? Try solving our issues
currency: "indian rupee",
native_language: ["hindi", "english"],
famous_for: "bollywood, yoga, hinduism, food and diversity",
phone_code: "+91",
flag: "https://flagpedia.net/data/flags/h80/in.png"
phone_code: "+91",
flag: "https://flagpedia.net/data/flags/h80/in.png"
},
];
```
Expand Down Expand Up @@ -178,34 +178,34 @@ This section contains nt to _contribute_ to open source? Try solving our issues
currency: "burundi franc",
native_language: ["kirundi", "french"],
famous_for: "wildlife and greenery",
phone_code: "+257",
flag: "https://flagpedia.net/data/flags/h80/bi.png"
phone_code: "+257",
flag: "https://flagpedia.net/data/flags/h80/bi.png"
},
{
country: "palau",
capital: "melekeok",
currency: "united states dollar",
native_language: ["english", "palauan"],
famous_for: "jellyfish lake",
phone_code: "+680",
flag: "https://flagpedia.net/data/flags/h80/pw.png"
phone_code: "+680",
flag: "https://flagpedia.net/data/flags/h80/pw.png"
},
{
country: "dominican republic",
capital: "santo domingo",
currency: "dominican peso",
native_language: ["spanish"],
famous_for: "blue ocean water, white-sand beaches and beautiful resorts",
phone_code: "+1-809, +1-829, +1-849",
flag: "https://flagpedia.net/data/flags/h80/do.png"
phone_code: "+1-809, +1-829, +1-849",
flag: "https://flagpedia.net/data/flags/h80/do.png"
},
];
```

---

- `getCountriesByFamousFor(famousThing)` <br>
This method returns an array of objects, each object containing **country**, **capital**, **currency**, **native_language**, **famouse_for**, **phone_code**, and **flag** sorted by the _famousThing_ passed as the parameter.<br>
This method returns an array of objects, each object containing **country**, **capital**, **currency**, **native_language**, **famous_for**, **phone_code**, and **flag** sorted by the _famousThing_ passed as the parameter.<br>
Response for getCountriesByFamousFor('oil')

```javascript
Expand All @@ -216,56 +216,88 @@ This section contains nt to _contribute_ to open source? Try solving our issues
currency: 'algerian dinar',
native_language: ['arabic', 'tamazight', 'french'],
famous_for: 'oil and gas reserves',
phone_code: '+213',
flag: "https://flagpedia.net/data/flags/h80/dz.png"
phone_code: '+213',
flag: "https://flagpedia.net/data/flags/h80/dz.png"
},
{
country: 'angola',
capital: 'luanda',
currency: 'kwanza',
native_language: ['portuguese'],
famous_for: 'oil',
phone_code: '+244',
flag: "https://flagpedia.net/data/flags/h80/ao.png"
phone_code: '+244',
flag: "https://flagpedia.net/data/flags/h80/ao.png"
},
{
country: 'bahrain',
capital: 'manama',
currency: 'bahraini dinar',
native_language: ['arabic'],
famous_for: 'oil, pearls and world heritage sites',
phone_code: '+973',
flag: "https://flagpedia.net/data/flags/h80/bh.png"
phone_code: '+973',
flag: "https://flagpedia.net/data/flags/h80/bh.png"
},
{
country: 'bulgaria',
capital: 'sofia',
currency: 'lev',
native_language: ['bulgarian'],
famous_for: 'lavender oil and the rose valley',
phone_code: '+359',
flag: "https://flagpedia.net/data/flags/h80/bg.png"
phone_code: '+359',
flag: "https://flagpedia.net/data/flags/h80/bg.png"
},
{
country: 'central african republic',
capital: 'bangui',
currency: 'central african cfa franc',
native_language: ['sango', 'french'],
famous_for: 'diamonds, gold, oil and uranium',
phone_code: '+236',
flag: "https://flagpedia.net/data/flags/h80/cf.png"
phone_code: '+236',
flag: "https://flagpedia.net/data/flags/h80/cf.png"
},
{
country: 'norway',
capital: 'oslo',
currency: 'norwegian krone',
native_language: ['norwegian'],
famous_for: 'oil, fjords, mountains and midnight sun',
phone_code: '+47',
flag: "https://flagpedia.net/data/flags/h80/no.png"
phone_code: '+47',
flag: "https://flagpedia.net/data/flags/h80/no.png"
},
];
```
---

- `getCountriesByLandLock(isLandLocked: boolean)` <br>
This method returns an array of objects, each object containing **country**, **capital**, **currency**, **native_language**, **famous_for**, **phone_code**, **flag**, **drive_direction** and **is_landlocked** sorted by the _isLandlocked property which is boolean_ passed as the parameter.<br>
Response for getCountriesByLandLock(true)

```javascript
[
{
country: 'afghanistan',
capital: 'kabul',
currency: 'afghani',
native_language: ['dari persian', 'pashto'],
famous_for: 'rugs, taliban',
phone_code: '+93',
flag: 'https://flagpedia.net/data/flags/h80/af.png',
drive_direction: 'right',
is_landlocked: true
},
{
country: 'andorra',
capital: 'andorra la vella',
currency: 'euro',
native_language: ['catalan'],
famous_for: 'tourism and tobacco',
phone_code: '+244',
flag: 'https://flagpedia.net/data/flags/h80/ad.png',
drive_direction: 'right',
is_landlocked: true
}
];
```

---

Expand Down Expand Up @@ -752,7 +784,6 @@ console.log(wcc.getCountriesByFamousFor("oil"));
---

### Example #9

> Get all `countries` located in '_eu_'.
```javascript
Expand Down Expand Up @@ -797,6 +828,16 @@ const wcc = require("world-countries-capitals");
console.log(wcc.getCountriesByConstitutionalForm("republic"));
```

### Example #13

> Get the details of all `countries` that are '_landlocked_'.
```javascript
const wcc = require("world-countries-capitals");

console.log(wcc.getCountriesByLandLock(true));
```

---

## Demo
Expand Down

0 comments on commit 820e1f3

Please sign in to comment.