Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
is-absolute-url
Advanced tools
The is-absolute-url npm package is used to check if a given URL is an absolute URL. This can be particularly useful in web development and applications where URL validation or manipulation is required.
Check if a URL is absolute
This feature allows developers to determine if a URL string is an absolute URL. It returns true for URLs that include a protocol and domain name, and false for relative URLs or paths.
const isAbsoluteUrl = require('is-absolute-url');
console.log(isAbsoluteUrl('https://example.com')); // true
console.log(isAbsoluteUrl('/my/path')); // false
The 'is-url' package checks if a string is a URL. It is similar to 'is-absolute-url' but does not specifically focus on absolute URLs, making it broader in scope but less specialized for checking absolute URLs.
The 'valid-url' package provides methods to validate URLs and check if they are absolute. It offers more comprehensive URL validation features compared to 'is-absolute-url', which strictly checks for absolute URLs.
Check if a URL is absolute
$ npm install is-absolute-url
import isAbsoluteUrl from 'is-absolute-url';
isAbsoluteUrl('https://sindresorhus.com/foo/bar');
//=> true
isAbsoluteUrl('//sindresorhus.com');
//=> false
isAbsoluteUrl('foo/bar');
//=> false
See is-relative-url for the inverse.
FAQs
Check if a URL is absolute
We found that is-absolute-url 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.