Skip to content

Commit

Permalink
now using lastIndexOf instead of startsWith
Browse files Browse the repository at this point in the history
so that it's compatible with older browsers
  • Loading branch information
Mate Hegedus committed Nov 20, 2017
1 parent c529ef2 commit ee6dffa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion modules/PathUtils.js
Expand Up @@ -5,7 +5,7 @@ export const stripLeadingSlash = (path) =>
path.charAt(0) === '/' ? path.substr(1) : path

export const hasBasename = (path, prefix) =>
path.toLowerCase().startsWith(prefix.toLowerCase()) && "/?#".indexOf(path.charAt(prefix.length)) !== -1
path.toLowerCase().lastIndexOf(prefix.toLowerCase(), 0) === 0 && "/?#".indexOf(path.charAt(prefix.length)) !== -1

export const stripBasename = (path, prefix) =>
hasBasename(path, prefix) ? path.substr(prefix.length) : path
Expand Down

0 comments on commit ee6dffa

Please sign in to comment.