Skip to content

Commit

Permalink
add get-url-domain: fetches the domain with protocol/scheme and port
Browse files Browse the repository at this point in the history
  • Loading branch information
balupton committed Jun 28, 2021
1 parent e1d6daa commit 96d9793
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions commands/get-url-domain
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env node
const input = process.argv[2];
if (!input) throw new Error("USAGE: get-url-domain <url>");
const url = new URL(input)
process.stdout.write(url.protocol + '//' + url.host);

0 comments on commit 96d9793

Please sign in to comment.