{"name":"is-relative-url","version":"4.1.1","description":"Check if a URL is relative","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/is-relative-url.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":"./index.js","types":"./index.d.ts","sideEffects":false,"engines":{"node":">=14.16"},"scripts":{"//test":"xo && ava && tsd","test":"ava && tsd"},"keywords":["url","relative","absolute","uri","is","check"],"dependencies":{"is-absolute-url":"^4.0.1"},"devDependencies":{"ava":"^4.3.0","tsd":"^0.20.0","xo":"^0.49.0"},"gitHead":"5d4dd00c1fc6a334bc53eef604f1767ac19800e9","_id":"is-relative-url@4.1.1","bugs":{"url":"https://github.com/sindresorhus/is-relative-url/issues"},"homepage":"https://github.com/sindresorhus/is-relative-url#readme","_nodeVersion":"22.23.1","_npmVersion":"12.0.1","dist":{"integrity":"sha512-WPsbw9cI2lRbH8j7/14e4dtq/jGIicXOBLlD5cuFhgQCBNgZUVJzU+xBi9pFhTkcTxZJY8l8osSxkhY3xY6emw==","shasum":"c8b3cf27ec09fb72a33506fae447a69d00b41342","tarball":"http://registry-npm.ywwl.com/is-relative-url/download/is-relative-url-4.1.1.tgz","fileCount":5,"unpackedSize":5536,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIBGUseeuP8mc5PFyv6J0FaAopNHGR/LVHK4y00hlerUcAiBjun0M6tqQJ6466vcDLRlgZMDSl0OfhlJRcfNMGva5ug=="}],"size":2340,"noattachment":false,"key":"/is-relative-url/-/is-relative-url-4.1.1.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/is-relative-url_4.1.1_1789420295628_0.7283050536486919"},"_hasShrinkwrap":false,"readme":"# is-relative-url\n\n> Check if a URL is relative\n\n## Install\n\n```sh\nnpm install is-relative-url\n```\n\n## Usage\n\n```js\nimport isRelativeUrl from 'is-relative-url';\n\nisRelativeUrl('foo/bar');\n//=> true\n\nisRelativeUrl('https://sindresorhus.com/foo/bar');\n//=> false\n\nisRelativeUrl('//sindresorhus.com');\n//=> true\n```\n\n## API\n\n### isRelativeUrl(url, options?)\n\n#### url\n\nType: `string`\n\nThe URL to check.\n\n#### options\n\nType: `object`\n\n##### allowProtocolRelative\n\nType: `boolean`\\\nDefault: `true`\n\nAllow [protocol-relative URLs](https://en.wikipedia.org/wiki/URL#Protocol-relative_URLs) (e.g., `//example.com`) to be considered relative.\n\nSetting this to `false` treats URLs starting with two slash or backslash separators (`//`, `\\\\`, `/\\`, `\\/`) as absolute.\n\nThis does not prevent open redirects. For redirect validation, parse against a fixed trusted HTTP(S) base, reject parse failures or mismatched origins/protocols, and use the parsed URL without further changes.\n\n> [!NOTE]\n> Protocol-relative URLs are [technically relative](https://datatracker.ietf.org/doc/html/rfc3986#section-4.2) according to [RFC 3986](https://datatracker.ietf.org/doc/html/rfc3986), as they require the current page's protocol to resolve into absolute URLs. However, they can still navigate to external domains, which may be a security concern in certain contexts (e.g., preventing open redirects).\n\n## Related\n\nSee [is-absolute-url](https://github.com/sindresorhus/is-absolute-url) for the inverse.\n","publish_time":1789420295767,"_cnpm_publish_time":1789420295767,"dist-tags":{"latest":"4.1.1"}}