@solidjs/router
Advanced tools
Comparing version 0.7.0 to 0.7.1
@@ -151,5 +151,5 @@ import { isServer, delegateEvents, createComponent as createComponent$1, spread, mergeProps as mergeProps$1, template } from 'solid-js/web'; | ||
const hasSchemeRegex = /^(?:[a-z0-9]+:)?\/\//i; | ||
const trimPathRegex = /^\/+|\/+$/g; | ||
const trimPathRegex = /^\/+|(\/)\/+$/g; | ||
function normalizePath(path, omitSlash = false) { | ||
const s = path.replace(trimPathRegex, ""); | ||
const s = path.replace(trimPathRegex, "$1"); | ||
return s ? omitSlash || /^[?#]/.test(s) ? s : "/" + s : ""; | ||
@@ -207,6 +207,7 @@ } | ||
const locSegment = locSegments[i]; | ||
const key = segment[0] === ":" ? segment.slice(1) : segment; | ||
if (segment[0] === ":" && matchSegment(locSegment, matchFilter(key))) { | ||
const dynamic = segment[0] === ":"; | ||
const key = dynamic ? segment.slice(1) : segment; | ||
if (dynamic && matchSegment(locSegment, matchFilter(key))) { | ||
match.params[key] = locSegment; | ||
} else if (!matchSegment(locSegment, segment)) { | ||
} else if (dynamic || !matchSegment(locSegment, segment)) { | ||
return null; | ||
@@ -213,0 +214,0 @@ } |
import { createMemo, getOwner, runWithOwner } from "solid-js"; | ||
const hasSchemeRegex = /^(?:[a-z0-9]+:)?\/\//i; | ||
const trimPathRegex = /^\/+|\/+$/g; | ||
const trimPathRegex = /^\/+|(\/)\/+$/g; | ||
export function normalizePath(path, omitSlash = false) { | ||
const s = path.replace(trimPathRegex, ""); | ||
const s = path.replace(trimPathRegex, "$1"); | ||
return s ? (omitSlash || /^[?#]/.test(s) ? s : "/" + s) : ""; | ||
@@ -60,7 +60,8 @@ } | ||
const locSegment = locSegments[i]; | ||
const key = segment[0] === ":" ? segment.slice(1) : segment; | ||
if (segment[0] === ":" && matchSegment(locSegment, matchFilter(key))) { | ||
const dynamic = segment[0] === ":"; | ||
const key = dynamic ? segment.slice(1) : segment; | ||
if (dynamic && matchSegment(locSegment, matchFilter(key))) { | ||
match.params[key] = locSegment; | ||
} | ||
else if (!matchSegment(locSegment, segment)) { | ||
else if (dynamic || !matchSegment(locSegment, segment)) { | ||
return null; | ||
@@ -67,0 +68,0 @@ } |
@@ -9,3 +9,3 @@ { | ||
"license": "MIT", | ||
"version": "0.7.0", | ||
"version": "0.7.1", | ||
"homepage": "https://github.com/solidjs/solid-router#readme", | ||
@@ -12,0 +12,0 @@ "repository": { |
@@ -536,3 +536,3 @@ <p> | ||
<span>Page: {searchParams.page}</span> | ||
<button onClick={() => setSearchParams({ page: searchParams.page + 1 })}>Next Page</button> | ||
<button onClick={() => setSearchParams({ page: (parseInt(searchParams.page) || 0) + 1 })}>Next Page</button> | ||
</div> | ||
@@ -539,0 +539,0 @@ ); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
92314
1959