Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mehmetcanfarsak committed Mar 25, 2024
0 parents commit 00cc7b4
Show file tree
Hide file tree
Showing 12 changed files with 7,884 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/main.yml
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
26 changes: 26 additions & 0 deletions .github/workflows/release.yml
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 }}



8 changes: 8 additions & 0 deletions .gitignore
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
66 changes: 66 additions & 0 deletions README.md
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

```
4 changes: 4 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
preset: "ts-jest",
testEnvironment: "node",
};
Loading

0 comments on commit 00cc7b4

Please sign in to comment.