Skip to content

Commit

Permalink
Add TypeScript types (#6)
Browse files Browse the repository at this point in the history
Co-authored-by: Sindre Sorhus <[email protected]>
  • Loading branch information
risu729 and sindresorhus committed Jan 1, 2024
1 parent 3950819 commit de7376b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
16 changes: 16 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -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;
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@
},
"type": "module",
"exports": "./index.js",
"types": "./index.d.ts",
"engines": {
"node": ">=18"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
"index.js",
"index.d.ts"
],
"keywords": [
"compare",
Expand Down

0 comments on commit de7376b

Please sign in to comment.