
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
@the-node-forge/url-validator
Advanced tools
A lightweight and efficient library for validating URLs. It ensures that URLs are correctly formatted and provides an optional feature to check whether a URL is live by sending an HTTP request. This package is designed for web applications, APIs, and serv
A lightweight and efficient URL validation package for JavaScript/TypeScript applications. This package helps developers validate URL syntax, check if a URL is live, and ensure proper domain formatting for better security.
http://
and https://
URLs.npm install @the-node-forge/url-validator
or using Yarn:
yarn add @the-node-forge/url-validator
Easily check if a URL is properly formatted and follows best practices.
import { validateUrl } from '@the-node-forge/url-validator';
console.log(validateUrl('https://example.com')); // ✅ true
console.log(validateUrl('htp://invalid-url')); // ❌ false
console.log(validateUrl('http://example')); // ❌ false (Missing TLD)
console.log(validateUrl('http://999.999.999.999')); // ❌ false (Invalid IP Address)
console.log(validateUrl('http://exa mple.com')); // ❌ false (Contains spaces)
Test if a URL is reachable by sending a request with customizable allowed status codes.
import { isUrlLive } from '@the-node-forge/url-validator';
isUrlLive('https://example.com').then(console.log); // ✅ true/false
By default, the following status codes are considered "live": [200, 301, 302, 403]
.
You can override this list if needed:
isUrlLive('https://example.com', [200, 301, 302]).then(console.log); // ✅ true if status is in the list
validateUrl(url: string): boolean;
Parameter | Type | Description |
---|---|---|
url | string | The URL to validate. |
Returns: boolean
– true
if the URL is valid, otherwise false
.
isUrlLive(url: string, allowedStatusCodes?: number[]): Promise<boolean>;
Parameter | Type | Description |
---|---|---|
url | string | The URL to check if it's live. |
allowedStatusCodes | number[] (optional) | A list of status codes that should be considered "live". |
Returns: Promise<boolean>
– Resolves to true
if the URL is reachable and
returns a status in allowedStatusCodes
, otherwise false
.
Contributions are welcome! Please submit
issues or
pull requests.
If you find this package useful, please give it a ⭐ on
GitHub
FAQs
A lightweight and efficient library for validating URLs. It ensures that URLs are correctly formatted and provides an optional feature to check whether a URL is live by sending an HTTP request. This package is designed for web applications, APIs, and serv
The npm package @the-node-forge/url-validator receives a total of 17 weekly downloads. As such, @the-node-forge/url-validator popularity was classified as not popular.
We found that @the-node-forge/url-validator demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers 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.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.