Adds a trailing / to the string if it does not already end with a /
It also converts an empty string to ./
Just use new URL(s, document?.baseURI) for the equivalent functionality in modern browsers.
Combines a string and an optional second part (typically, REST ID), adding / between them if needed.
If the base string is undefined, the function will return undefined regardless of the ID part.
Just use
document?.baseURI ?? ''for the equivalent functionality in modern browsers.