Comparing version 17.4.0 to 17.5.0
# CHANGELOG | ||
## 17.5.0 | ||
Export `extractParams` router url parsing function. | ||
## 17.4.0 | ||
@@ -4,0 +8,0 @@ |
{ | ||
"name": "bobril", | ||
"version": "17.4.0", | ||
"version": "17.5.0", | ||
"description": "Component Oriented MVC Framework with virtual DOM and CSS", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -36,5 +36,3 @@ import { | ||
export interface Params { | ||
[name: string]: string | undefined; | ||
} | ||
export interface Params extends Record<string, string | undefined> {} | ||
@@ -189,9 +187,9 @@ // Just marker interface | ||
// Extracts the portions of the given URL path that match the given pattern. | ||
// Returns null if the pattern does not match the given path. | ||
function extractParams(pattern: string, path: string): Params | null { | ||
/// Extracts the portions of the given URL path that match the given pattern. | ||
/// Returns undefined if the pattern does not match the given path. | ||
export function extractParams(pattern: string, path: string): Params | undefined { | ||
var object = compilePattern(pattern); | ||
var match = decodeUrl(path).match(object.matcher); | ||
if (!match) return null; | ||
if (!match) return undefined; | ||
@@ -209,5 +207,5 @@ var params: { [name: string]: string } = {}; | ||
// Returns a version of the given route path with params interpolated. | ||
// Throws if there is a dynamic segment of the route path for which there is no param. | ||
export function injectParams(pattern: string, params?: Params) { | ||
/// Returns a version of the given route path with params interpolated. | ||
/// Throws if there is a dynamic segment of the route path for which there is no param. | ||
export function injectParams(pattern: string, params?: Params): string { | ||
params = params || {}; | ||
@@ -251,3 +249,3 @@ | ||
var defaultRoute: IRoute | undefined; | ||
var params: Params | null; | ||
var params: Params | undefined; | ||
for (var i = 0; i < l; i++) { | ||
@@ -254,0 +252,0 @@ var r = rs[i]!; |
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
387710
9269