mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 13:50:31 +00:00
feat: Lerna shared
This commit is contained in:
2260
shared/bigcapital-utils/src/countries/constant.ts
Normal file
2260
shared/bigcapital-utils/src/countries/constant.ts
Normal file
File diff suppressed because it is too large
Load Diff
20
shared/bigcapital-utils/src/countries/index.ts
Normal file
20
shared/bigcapital-utils/src/countries/index.ts
Normal 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;
|
||||
};
|
||||
12
shared/bigcapital-utils/src/countries/types.ts
Normal file
12
shared/bigcapital-utils/src/countries/types.ts
Normal 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;
|
||||
3
shared/bigcapital-utils/src/index.ts
Normal file
3
shared/bigcapital-utils/src/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export * from './countries';
|
||||
|
||||
export const test = () => {};
|
||||
Reference in New Issue
Block a user