is-url-http is a focused utility library for JavaScript and TypeScript environments that efficiently determines if a given string represents a valid HTTP or HTTPS URL. It primarily checks the scheme (http or https) and basic URL structure based on WHATWG URL Standard conventions. The current stable version is 2.3.13, and the library exhibits an active maintenance schedule with frequent patch and minor updates, typically every few weeks, addressing bug fixes and minor enhancements. Its key differentiators include its singular focus on HTTP/HTTPS URL validation, ensuring a small footprint and predictable behavior without delving into broader URL parsing concerns. A notable feature is the provision of a separate 'lightweight' bundle, specifically optimized for browser environments, which aims to minimize bundle size while retaining core validation functionality. This makes it an ideal choice for client-side applications where every byte counts, differentiating it from more comprehensive URL manipulation libraries.
npm install is-url-httpVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to import and use both the standard and lightweight versions of `is-url-http` to validate different URL strings, highlighting their simple boolean return.
Understand that `is-url-http` is for scheme validation only; for broader URL validation or network reachability checks, consider a more comprehensive URL parsing library or a dedicated network library.
Perform comprehensive testing against your specific URL patterns when using the lightweight bundle. For critical or complex URL validation scenarios where absolute consistency with WHATWG standards is paramount, consider using the full `is-url-http` package.
Use a default import instead: `import isUrlHttp from 'is-url-http';`
Assign the `require` call directly to the function variable: `const isUrlHttp = require('is-url-http');`Ensure the import path is exactly `is-url-http/lightweight`. Verify `node_modules` structure and run `npm install` or `yarn install` to ensure all dependencies are correctly placed. If using bundlers, check alias configurations.