Skip to content

Commit

Permalink
feat: Add TypeScript typings (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
mitsuruog authored and jhnns committed May 29, 2019
1 parent 7710b74 commit 10b6693
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -3,6 +3,7 @@
"version": "2.2.1",
"description": "Splits an url into sub-domain, domain and effective top-level-domain",
"main": "./lib/parseDomain.js",
"types": "./lib/index.d.ts",
"scripts": {
"build": "run-s build:lib build:tries",
"build:lib": "run-s build:lib:clean build:lib:babel",
Expand Down
18 changes: 18 additions & 0 deletions src/index.d.ts
@@ -0,0 +1,18 @@
export as namespace parseDomain;

declare namespace parseDomain {
interface IParseOptions {
customTlds?: RegExp | string[];
privateTlds?: boolean;
}

interface IParsedDomain {
domain?: string;
subdomain?: string;
tld?: string;
}
}

declare function parseDomain (url: string, options?: parseDomain.IParseOptions): parseDomain.IParsedDomain;

export = parseDomain;

0 comments on commit 10b6693

Please sign in to comment.