Skip to content

Commit 82426e0

Browse files
author
karroch-a
committed
Initial commit
0 parents  commit 82426e0

File tree

9 files changed

+3778
-0
lines changed

9 files changed

+3778
-0
lines changed

.github/workflows/ci.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
matrix:
15+
node-version: [16.x, 18.x, 20.x]
16+
17+
steps:
18+
- uses: actions/checkout@v3
19+
- name: Use Node.js ${{ matrix.node-version }}
20+
uses: actions/setup-node@v3
21+
with:
22+
node-version: ${{ matrix.node-version }}
23+
- run: npm ci
24+
- run: npm run build
25+
- run: npm test

.gitignore

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
node_modules/
2+
npm-debug.log*
3+
yarn-debug.log*
4+
yarn-error.log*
5+
6+
dist/
7+
*.tsbuildinfo
8+
9+
.idea/
10+
.vscode/
11+
*.swp
12+
*.swo
13+
.DS_Store
14+
15+
coverage/
16+
17+
.env
18+
.env.local
19+
.env.*.local
20+
21+
# Logs
22+
logs/
23+
*.log
24+
25+
.npm
26+
27+
.eslintcache
28+
29+
.node_repl_history

README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Country Flags Converter
2+
3+
Convert ISO 3166-1 country codes to flag emojis. Simple and lightweight.
4+
5+
## Installation
6+
7+
```bash
8+
npm install @karroch/country-flags-emoji
9+
```
10+
11+
## Usage
12+
13+
```typescript
14+
import { countryFlags } from "@karroch/country-flags-emoji";
15+
16+
// Convert country codes to flags
17+
console.log(countryFlags("US")); // 🇺🇸
18+
console.log(countryFlags("MA")); // 🇲🇦
19+
console.log(countryFlags("GB")); // 🇬🇧
20+
console.log(countryFlags("ES")); // 🇪🇸
21+
```
22+
23+
## API
24+
25+
### `countryFlags(countryCode: string): string`
26+
27+
Converts a two-letter country code to its corresponding emoji flag.
28+
29+
- `countryCode`: A two-letter ISO 3166-1 country code (case insensitive)
30+
- Returns: The emoji flag representation
31+
- Throws: Error if input is invalid
32+
33+
## Features
34+
35+
- TypeScript support
36+
- Zero dependencies
37+
- Lightweight
38+
- Case insensitive
39+
- Input validation
40+
41+
## License
42+
43+
MIT © [Your Name]

jest.config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module.exports = {
2+
preset: "ts-jest",
3+
testEnvironment: "node",
4+
testMatch: ["**/*.test.ts"],
5+
moduleFileExtensions: ["ts", "js"],
6+
transform: {
7+
"^.+\\.ts$": "ts-jest",
8+
},
9+
};

0 commit comments

Comments
 (0)