Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: CI

on:
push:
branches: [main, master]
pull_request:
release:
types: [published]
workflow_dispatch:
inputs:
version:
description: 'Version to publish (e.g., 1.0.0)'
required: true
type: string

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 8.x
- run: yarn install
- run: yarn build

publish:
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 8.x
- run: npm config set registry ${{ secrets.NPM_REGISTRY_URL }}
- run: yarn install
- name: Set version
if: github.event_name == 'workflow_dispatch'
run: npm version ${{ github.event.inputs.version }} --no-git-tag-version
- run: yarn build
- run: yarn publish --non-interactive
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
9 changes: 7 additions & 2 deletions src/fns.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,13 @@ function extractQueryParams(path) {
* @return {String}
*/
function extractPath(base, canonicalPath) {
let path = canonicalPath?.replace(base, '') || '/'
let qsIndex = path.indexOf('?')
let path = '/';

if (canonicalPath != null && typeof canonicalPath === 'string') {
path = canonicalPath.replace(base, '') || '/';
}

let qsIndex = path.indexOf('?');
return (qsIndex > -1) ? path.slice(0, qsIndex) : path
}

Expand Down