Skip to content

Commit

Permalink
Merge pull request #11 from mehmetcanfarsak/Add-Usage-instructions-fo…
Browse files Browse the repository at this point in the history
…r-commonjs-and-Add-keywords-in-package.json-file

Add Usage instructions for commonjs and Add keywords in package.json …
  • Loading branch information
mehmetcanfarsak authored Apr 14, 2024
2 parents 29d6a30 + fac271c commit 36b4c8c
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
47 changes: 47 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ npm install country-codes-flags-phone-codes

## Usage

### For TypeScript

```typescript
import {
getCountryFlagEmojiFromCountryCode,
Expand Down Expand Up @@ -68,6 +70,51 @@ console.log("countries", countries); // [{ name: 'United States', code: 'US', di

```

### For CommonJs

```javascript
const {
getCountryFlagEmojiFromCountryCode,
getCountryNameFromCountryCode,
getCountryCodeFromCountryName,
getCountryFlagEmojiFromCountryName,
getCountryNameFromCountryFlagEmoji,
getCountryCodeFromCountryFlagEmoji,
getCountryFromCountryCode,
getCountryFromCountryName,
getCountryFromCountryFlagEmoji,
getCountryFromCountryCodeOrName,
getCountryFromCountryCodeOrFlagEmoji,
getCountryFromCountryNameOrFlagEmoji,
getCountryFromCountryCodeOrNameOrFlagEmoji,
getCountryNameFromCountryCodeOrNameOrFlagEmoji,
getCountryCodeFromCountryCodeOrNameOrFlagEmoji,
getCountryFlagEmojiFromCountryCodeOrNameOrFlagEmoji,
getCountryDialCodeFromCountryCodeOrNameOrFlagEmoji,
countries,
CountryInterface,
} = require("country-codes-flags-phone-codes");
console.log(getCountryFlagEmojiFromCountryCode("US")); // 🇺🇸
console.log(getCountryNameFromCountryCode("US")); // United States
console.log(getCountryCodeFromCountryName("United States")); // US
console.log(getCountryFlagEmojiFromCountryName("United States")); // 🇺🇸
console.log(getCountryNameFromCountryFlagEmoji("🇺🇸")); // United States
console.log(getCountryCodeFromCountryFlagEmoji("🇺🇸")); // US
console.log(getCountryFromCountryCode("US")); // { name: 'United States', code: 'US', dialCode: '+1', flag: '🇺🇸' }
console.log(getCountryFromCountryName("United States")); // { name: 'United States', code: 'US', dialCode: '+1', flag: '🇺🇸' }
console.log(getCountryFromCountryFlagEmoji("🇺🇸")); // { name: 'United States', code: 'US', dialCode: '+1', flag: '🇺🇸' }
console.log(getCountryFromCountryCodeOrName("US")); // { name: 'United States', code: 'US', dialCode: '+1', flag: '🇺🇸'
console.log(getCountryFromCountryCodeOrFlagEmoji("US")); // { name: 'United States', code: 'US', dialCode: '+1', flag: '🇺🇸' }
console.log(getCountryFromCountryNameOrFlagEmoji("United States")); // { name: 'United States', code: 'US', dialCode: '+1', flag: '🇺🇸' }
console.log(getCountryFromCountryCodeOrNameOrFlagEmoji("US")); // { name: 'United States', code: 'US', dialCode: '+1', flag: '🇺🇸' }
console.log(getCountryNameFromCountryCodeOrNameOrFlagEmoji("US")); // United States
console.log(getCountryCodeFromCountryCodeOrNameOrFlagEmoji("United States")); // US
console.log(getCountryFlagEmojiFromCountryCodeOrNameOrFlagEmoji("US")); // 🇺🇸
console.log(getCountryDialCodeFromCountryCodeOrNameOrFlagEmoji("US")); // +1
console.log("countries", countries); // [{ name: 'United States', code: 'US', dialCode: '+1', flag: '🇺🇸' }, ...]
```


## How to Contribute

Thank you for considering contributing to this project! Contributions are essential to keep the project thriving and improving. Below are steps on how you can contribute to the project:
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
},
"keywords": [
"backend",
"commonjs",
"country",
"country-code",
"country-codes",
Expand All @@ -45,6 +46,7 @@
"phone-prefixes",
"telephone-codes",
"telephone-prefixes",
"typescript",
"world-countries",
"world-country-codes",
"world-country-flags",
Expand Down

0 comments on commit 36b4c8c

Please sign in to comment.