feat: Lerna shared

This commit is contained in:
Ahmed Bouhuolia
2024-10-06 17:20:28 +02:00
parent 184648040c
commit 6cad929738
13 changed files with 15 additions and 22 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,20 @@
import { Countries } from './constant';
import { Country, Maybe } from './types';
export const getAllCountries = () => {
return Object.keys(Countries).map((countryCode) => {
return {
...Countries[countryCode],
countryCode,
};
});
};
export const findByIsoCountryCode = (
isoCode: string
): Maybe<Country & { countryCode: string }> => {
const _isoCode = isoCode?.toUpperCase();
const country = Countries[_isoCode];
return country ? { ...country, countryCode: isoCode } : null;
};

View File

@@ -0,0 +1,12 @@
export interface Country {
name: string;
native: string;
phone: number[];
continent: string;
continents?: string[];
capital: string;
currency: string[];
languages: string[];
}
export type Maybe<T> = T | null;

View File

@@ -0,0 +1,3 @@
export * from './countries';
export const test = () => {};