diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 0000000..50daeaa --- /dev/null +++ b/index.d.ts @@ -0,0 +1,16 @@ +/** +Compare URLs by first normalizing them. + +@param firstUrl - The first URL to compare. +@param secondUrl - The second URL to compare. +@returns A boolean indicating whether the URLs are the same. + +@example +``` +import compareUrls from 'compare-urls'; + +compareUrls('HTTPS://sindresorhus.com/?b=b&a=a', 'sindresorhus.com/?a=a&b=b'); +//=> true +``` +*/ +export default function compareUrls(firstUrl: string, secondUrl: string): boolean; diff --git a/package.json b/package.json index 440b73d..a188297 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ }, "type": "module", "exports": "./index.js", + "types": "./index.d.ts", "engines": { "node": ">=18" }, @@ -19,7 +20,8 @@ "test": "xo && ava" }, "files": [ - "index.js" + "index.js", + "index.d.ts" ], "keywords": [ "compare",