mirror of
https://github.com/morluto/rea.git
synced 2026-10-29 10:55:57 +00:00
URL.search and URL.hash are empty for both a missing component and an explicit empty one, so endpoint and origin checks were accepting URLs the callers meant to reject. Co-authored-by: Cursor <cursoragent@cursor.com>
8 lines
358 B
TypeScript
8 lines
358 B
TypeScript
/**
|
|
* True when the URL spells a query or fragment, including an empty one.
|
|
* `URL.search` and `URL.hash` are empty both when that component is absent
|
|
* and when it is present but empty, so href is the spelling that keeps them apart.
|
|
*/
|
|
export const urlDeclaresQueryOrFragment = (url: URL): boolean =>
|
|
url.href.includes("?") || url.href.includes("#");
|