
Security News
The Code You Didn't Write Is Still Yours to Defend
AI agents are pulling packages into environments no scanner is watching, creating exposure before security teams can see it.
hyperlink-parser
Advanced tools
HyperlinkParser.js is an util to parse the URLs. Can be used in Node.js and the browsers. The properties of the parsed URL is same as the properties of HTMLHyperlinkElementUtils. For more details, see the example in the following section.
npm i hyperlink-parser
var HyperlinkParser = require('hyperlink-parser');
var url = 'https://user:pass@example.com:8080/search?q=javascript#results';
/**
* @type {HyperlinkParser.Hyperlink}
*/
var hyperlink = HyperlinkParser.parse(url);
The hyperlink is an instance of HyperlinkParser.Hyperlink which holds the following informations:
{
"href": "https://user:pass@example.com:8080/search?q=javascript#results",
"origin": "https://example.com:8080",
"protocol": "https:",
"username": "user",
"password": "pass",
"host": "example.com:8080",
"hostname": "example.com",
"port": "8080",
"pathname": "/search",
"search": "?q=javascript",
"hash": "#results"
}
Do not modify the properties of the Hyperlink instance directly, because some properties has dependencies on the others. The best way to update the properties is using the setter methods, which will handle the dependencies among them. All the APIs are listed as follow:
As you can see, there is no setter method to modify the origin property. If you want to modify the origin property,
call setProtocol(protocol) and setHost(host).
# Start local server and compiler
npm run dev
# Build the release bundle
npm run build
# Run test
npm test
FAQs
A tool for parsing hyperlinks
The npm package hyperlink-parser receives a total of 8 weekly downloads. As such, hyperlink-parser popularity was classified as not popular.
We found that hyperlink-parser demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
AI agents are pulling packages into environments no scanner is watching, creating exposure before security teams can see it.

Security News
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.