Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add TypeScript typings #66

Merged
merged 2 commits into from May 29, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -3,6 +3,7 @@
"version": "2.1.7",
"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
13 changes: 13 additions & 0 deletions src/index.d.ts
@@ -0,0 +1,13 @@
export as namespace parseDomain;

declare namespace parseDomain {
interface IParsedDomain {
domain?: string;
subdomain?: string;
tld?: string;
}
}

declare function parseDomain (url: string, customTlds?: RegExp | string[], privateTlds?: boolean): parseDomain.IParsedDomain;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

customTlds and privateTlds should be part of an ParseOptions object. Take a look at the README :)


export = parseDomain;