Repository: kyeotic/raviger (ts)

Issue:
Base path matcher regexp is not case insensitive
Hi @kyeotic 👋 

We had a bug ticket in production where our silly users decided to access our single page app by changing some part of the base path URL to be lowercase (silly I know).

Unfortunately that is something that we used to support before so we had to write a temporary fix on our side.

The issue is here: https://github.com/kyeotic/raviger/blob/ea4a3f5a345268bd56af9f0716b7e49bc936d32a/src/path.js#L78-L80

If the line was changed to make the RegExp case insensitive, our problem would be solved:
```js
return new RegExp('^' + basePath, 'i')
```

Would it be possible to either make it case insensitive, or have an option to do so?

Thanks in advance!

Pull request description:
fix case insensitive matching for basePath
fixes #58 

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1fb62c0..5cbd457 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
 and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
 
+## [1.4.4] - 2020-06-26
+### Fixed
+- `basePath` matches not using case-insensitive like route paths
+
 ## [1.4.3] - 2020-05-12
 ### Fixed
 - `useQueryParam` using a `?` when no query is set
diff --git a/src/path.js b/src/path.js
index c01f006..b40dd29 100644
--- a/src/path.js
+++ b/src/path.js
@@ -76,5 +76,5 @@ function isPredicateActive(predicate) {
 }
 
 function basePathMatcher(basePath) {
-  return new RegExp('^' + basePath)
+  return new RegExp('^' + basePath, 'i')
 }


Test patch:
diff --git a/test/router.spec.js b/test/router.spec.js
index 614ad4e..078c2b0 100644
--- a/test/router.spec.js
+++ b/test/router.spec.js
@@ -79,6 +79,12 @@ describe('useRoutes', () => {
     act(() => navigate('/users/1'))
     expect(getByTestId('label')).toHaveTextContent('User 1')
   })
+  test('matches case insensitive rout', async () => {
+    const { getByTestId } = render(<Harness routes={routes} />)
+
+    act(() => navigate('/About'))
+    expect(getByTestId('label')).toHaveTextContent('about')
+  })
   test('works with lazy routes', async () => {
     let loader = new Promise(resolve => {
       setTimeout(() => resolve({ default: Route }), 50)
@@ -196,6 +202,8 @@ describe('useBasePath', () => {
     expect(getByTestId('basePath')).toHaveTextContent('none')
     act(() => navigate('/nested'))
     expect(getByTestId('basePath')).toHaveTextContent('nested')
+    act(() => navigate('/Nested'))
+    expect(getByTestId('basePath')).toHaveTextContent('nested')
   })
   test('returns empty string outside', async () => {
     const { getByTestId } = render(<Route />)