-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 00cc7b4
Showing
12 changed files
with
7,884 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: CI | ||
on: | ||
- push | ||
- pull_request | ||
jobs: | ||
test: | ||
name: Node.js ${{ matrix.node-version }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
node-version: | ||
- 18 | ||
- 16 | ||
- 14 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- run: npm install | ||
- run: npm run build | ||
- run: npm test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Publish to NPM | ||
on: | ||
release: | ||
types: [published] | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Setup Node | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '18.x' | ||
registry-url: 'https://registry.npmjs.org' | ||
- name: Install dependencies 🔧 | ||
run: npm install | ||
- name: Build Project 🏗️ | ||
run: npm run build | ||
- name: Publish package on NPM 📦 | ||
run: npm publish --access public | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/node_modules | ||
|
||
# Ignore test-related files | ||
/coverage.data | ||
/coverage/ | ||
|
||
# Build files | ||
/dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# Country Codes Flags Phone Codes 🏳 | ||
|
||
--- | ||
|
||
## Overview | ||
|
||
The Country Codes Flags Phone Codes npm package provides a simple and efficient way to access country codes, flags, and phone codes. With data on 246 countries, you can effortlessly retrieve information by country name, country code, or phone code. This package streamlines the process of working with country-related data in your JavaScript applications. | ||
|
||
## Features | ||
|
||
- Access country codes, flags, and phone codes conveniently. | ||
- Data on 246 countries available. | ||
- Search functionality to find information quickly. | ||
- Retrieve data by country name, country code, or phone code. | ||
|
||
## Installation | ||
|
||
You can install the package via npm: | ||
|
||
```bash | ||
npm install country-codes-flags-phone-codes | ||
``` | ||
|
||
## Usage | ||
|
||
```typescript | ||
import { | ||
getCountryFlagEmojiFromCountryCode, | ||
getCountryNameFromCountryCode, | ||
getCountryCodeFromCountryName, | ||
getCountryFlagEmojiFromCountryName, | ||
getCountryNameFromCountryFlagEmoji, | ||
getCountryCodeFromCountryFlagEmoji | ||
getCountryFromCountryCode, | ||
getCountryFromCountryName, | ||
getCountryFromCountryFlagEmoji, | ||
getCountryFromCountryCodeOrName, | ||
getCountryFromCountryCodeOrFlagEmoji, | ||
getCountryFromCountryNameOrFlagEmoji, | ||
getCountryFromCountryCodeOrNameOrFlagEmoji, | ||
getCountryNameFromCountryCodeOrNameOrFlagEmoji, | ||
getCountryCodeFromCountryCodeOrNameOrFlagEmoji, | ||
getCountryFlagEmojiFromCountryCodeOrNameOrFlagEmoji, | ||
getCountryDialCodeFromCountryCodeOrNameOrFlagEmoji, | ||
} from "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 | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = { | ||
preset: "ts-jest", | ||
testEnvironment: "node", | ||
}; |
Oops, something went wrong.