Skip to content

Commit b67d76f

Browse files
authored
Gettter added (#4)
* Add getter * Add typescript as dependency * Add non default export for PROVIDERS * Auto generate type definitions * Bump version
1 parent 7042b12 commit b67d76f

6 files changed

+42
-14
lines changed

index.d.ts

+9-10
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
declare type Provider = {
2-
id: string;
3-
url: string;
4-
label: string;
5-
keyword: string;
6-
};
7-
8-
declare const PROVIDERS: Provider[];
9-
10-
export = PROVIDERS;
1+
export const PROVIDERS: {
2+
id: string;
3+
url: string;
4+
label: string;
5+
keywords: string[];
6+
}[];
7+
export function getProvider(id: any): any;
8+
export default PROVIDERS;
9+
//# sourceMappingURL=index.d.ts.map

index.d.ts.map

+1
Original file line numberDiff line numberDiff line change

index.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const PROVIDERS = [
1+
export const PROVIDERS = [
22
{
33
id: 'GMAIL',
44
url: 'https://mail.google.com/',
@@ -39,8 +39,10 @@ const PROVIDERS = [
3939
id: 'APPLE',
4040
url: 'https://www.icloud.com/mail/',
4141
label: 'iCloud Mail',
42-
keyword: ['@icloud'],
42+
keywords: ['@icloud'],
4343
},
4444
];
4545

46+
export const getProvider = (id) => PROVIDERS.find((provider) => provider.id === id);
47+
4648
export default PROVIDERS;

package.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
{
22
"name": "@brachkow/email-providers",
3-
"version": "1.0.0",
3+
"version": "1.1.0",
44
"description": "URLs of popular email providers as JS object",
55
"main": "index.js",
66
"repository": {
77
"type": "git",
88
"url": "https://github.com/brachkow/email-providers.git"
99
},
1010
"author": "Timur Brachkow",
11-
"license": "MIT"
11+
"license": "MIT",
12+
"devDependencies": {
13+
"typescript": "^5.1.6"
14+
}
1215
}

pnpm-lock.yaml

+14
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tsconfig.json

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"include": ["index.js"],
3+
"compilerOptions": {
4+
"allowJs": true,
5+
"declaration": true,
6+
"emitDeclarationOnly": true,
7+
"declarationMap": true
8+
}
9+
}

0 commit comments

Comments
 (0)