Use ?? for base default

This commit is contained in:
Asher 2020-08-05 12:52:04 -05:00
parent 10c2b956ac
commit 3badf6bf7b
No known key found for this signature in database
GPG Key ID: D63C1EF81242354A

View File

@ -46,7 +46,7 @@ export const trimSlashes = (url: string): string => {
export const resolveBase = (base?: string): string => { export const resolveBase = (base?: string): string => {
// After resolving the base will either start with / or be an empty string. // After resolving the base will either start with / or be an empty string.
if (!base || base.startsWith("/")) { if (!base || base.startsWith("/")) {
return base || "" return base ?? ""
} }
const parts = location.pathname.split("/") const parts = location.pathname.split("/")
parts[parts.length - 1] = base parts[parts.length - 1] = base