Skip to content
Permalink
Browse files
fix: remove the trailing slash of paths in isSameURL (#542)
  • Loading branch information
ElmerZhang committed Mar 2, 2020
1 parent a4a1275 commit fb63f6f6dc17a7afa0b3a51d4b8f447de2ede7de
Showing 1 changed file with 1 addition and 1 deletion.
@@ -1,7 +1,7 @@
export const isUnset = o => typeof o === 'undefined' || o === null
export const isSet = o => !isUnset(o)

export const isSameURL = (a, b) => a.split('?')[0] === b.split('?')[0]
export const isSameURL = (a, b) => a.split('?')[0].replace(/\/+$/, '') === b.split('?')[0].replace(/\/+$/, '')

export const isRelativeURL = u =>
u && u.length && /^\/([a-zA-Z0-9@\-%_~][/a-zA-Z0-9@\-%_~]*)?([?][^#]*)?(#[^#]*)?$/.test(u)

0 comments on commit fb63f6f

Please sign in to comment.