Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
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
The npm package is-absolute-url receives a total of 9,351,919 weekly downloads. As such, is-absolute-url popularity was classified as popular.
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.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.