{"id":18235,"library":"component-url","title":"component-url","description":"A lightweight URL parser using the browser's `<a>` tag for resolution. Version 0.2.1 is the latest stable release; the package appears unmaintained since 2013. Provides parse, isAbsolute, isRelative, isCrossDomain functions. Uses native DOM parsing (no regex) but only works in browsers, not Node.js. Very minimal API compared to modern URL parsers like URL constructor or whatwg-url.","status":"abandoned","version":"0.2.1","language":"javascript","source_language":"en","source_url":null,"tags":["javascript"],"install":[{"cmd":"npm install component-url","lang":"bash","label":"npm"},{"cmd":"yarn add component-url","lang":"bash","label":"yarn"},{"cmd":"pnpm add component-url","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"CommonJS only; no ESM support. Package is not published on npm; use Component build tool.","wrong":"import url from 'url';","symbol":"url module (require)","correct":"var url = require('url');"},{"note":"Different API from Node.js url.parse; returns object with 'query' as string, not parsed.","wrong":"new URL('http://example.com')","symbol":"url.parse","correct":"url.parse('http://example.com')"},{"note":"Returns true if URL has a scheme; false for protocol-relative '//a.com'? Check source for behavior.","wrong":"url.isAbsolute('/relative')","symbol":"url.isAbsolute","correct":"url.isAbsolute('http://a.com')"}],"quickstart":{"code":"var url = require('url');\nvar parsed = url.parse('http://example.com:3000/store/shoes?sort=desc');\nconsole.log(parsed.protocol); // 'http:'\nconsole.log(parsed.host); // 'example.com:3000'\nconsole.log(parsed.port); // 3000\nconsole.log(parsed.hostname); // 'example.com'\nconsole.log(parsed.pathname); // '/store/shoes'\nconsole.log(parsed.search); // '?sort=desc'\nconsole.log(parsed.query); // 'sort=desc'\nconsole.log(parsed.hash); // ''\nconsole.log(parsed.href); // 'http://example.com:3000/store/shoes?sort=desc'\nconsole.log(url.isAbsolute('http://a.com')); // true\nconsole.log(url.isRelative('/foo')); // true\nconsole.log(url.isCrossDomain('http://other.com')); // true (if page is on different domain)","lang":"javascript","description":"Parses a URL and demonstrates all properties plus utility checks."},"warnings":[{"fix":"Use Node's built-in url module or whatwg-url for server-side.","message":"Only works in browser (uses <a> tag). Not compatible with Node.js.","severity":"breaking","affected_versions":">=0.0.0"},{"fix":"Always pass absolute URLs if you need consistent parsing.","message":"Relative URLs resolve against current page's base URL, leading to unexpected results.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use built-in URL constructor (https://developer.mozilla.org/en-US/docs/Web/API/URL) or whatwg-url.","message":"Package is abandoned (last release 2013). No bug fixes or security updates.","severity":"deprecated","affected_versions":">=0.0.0"},{"fix":"Use URLSearchParams or a query parser manually.","message":"Returns query as string, not parsed object. No automatic query string parsing.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Use Node's built-in url module: const url = require('url'); url.parse('http://...');","cause":"Running in Node.js where there is no DOM <a> element.","error":"ReferenceError: window is not defined"},{"fix":"Install with 'component install component/url' or use a browser-ready bundler like Duo.","cause":"Not installed via npm; this package is for Component build system only.","error":"Cannot find module 'url'"},{"fix":"Ensure you are using this specific package (component/url) via Component or copy source.","cause":"Using the Node.js url module's parse incorrectly or importing wrong package.","error":"Uncaught TypeError: url.parse is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}