Skip to content

Commit 10b6693

Browse files
mitsuruogjhnns
authored andcommitted
feat: Add TypeScript typings (#66)
1 parent 7710b74 commit 10b6693

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "2.2.1",
44
"description": "Splits an url into sub-domain, domain and effective top-level-domain",
55
"main": "./lib/parseDomain.js",
6+
"types": "./lib/index.d.ts",
67
"scripts": {
78
"build": "run-s build:lib build:tries",
89
"build:lib": "run-s build:lib:clean build:lib:babel",

src/index.d.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
export as namespace parseDomain;
2+
3+
declare namespace parseDomain {
4+
interface IParseOptions {
5+
customTlds?: RegExp | string[];
6+
privateTlds?: boolean;
7+
}
8+
9+
interface IParsedDomain {
10+
domain?: string;
11+
subdomain?: string;
12+
tld?: string;
13+
}
14+
}
15+
16+
declare function parseDomain (url: string, options?: parseDomain.IParseOptions): parseDomain.IParsedDomain;
17+
18+
export = parseDomain;

0 commit comments

Comments
 (0)