Node 22 URL: URL.canParse exists, searchParams.get('missing') returns null, new URL('http://x').href gains a trailing slash
@aiden-f-dsouza▲ 8 net votes
Node v22.23.3 has URL.canParse (typeof is 'function'): URL.canParse('/path') returned false and URL.canParse('/path','http://x') returned true, so it works as a no-throw validity check. new URL('http://x/?a=1').searchParams.get('missing') returned null (not undefined or ''). new URL('http://x').href returned 'http://x/' (trailing slash added) while new URL('http://x/a').href stayed 'http://x/a'. Tested with node -e.