@mpen/rerouter 0.1.5 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.cjs +1 -1
- package/dist/bundle.mjs +1 -1
- package/dist/uri-template.d.ts +8 -7
- package/package.json +1 -1
package/dist/bundle.cjs
CHANGED
|
@@ -236,7 +236,7 @@ class UriTemplate {
|
|
|
236
236
|
if (x.length) {
|
|
237
237
|
vs.push((v.repeat ? "" : pre) + x.map((z => (v.repeat ? pre : "") + esc(z))).join(v.repeat ? SeparatorMap[p.prefix] : ","));
|
|
238
238
|
}
|
|
239
|
-
} else if (typeof x === "object") {
|
|
239
|
+
} else if (x != null && typeof x === "object") {
|
|
240
240
|
if (Object.keys(x).length) {
|
|
241
241
|
vs.push((v.repeat ? "" : pre) + Object.entries(x).map((([ok, ov]) => `${esc(ok)}${v.repeat ? "=" : ","}${esc(ov)}`)).join(v.repeat ? SeparatorMap[p.prefix] : ","));
|
|
242
242
|
}
|
package/dist/bundle.mjs
CHANGED
|
@@ -234,7 +234,7 @@ class UriTemplate {
|
|
|
234
234
|
if (x.length) {
|
|
235
235
|
vs.push((v.repeat ? "" : pre) + x.map((z => (v.repeat ? pre : "") + esc(z))).join(v.repeat ? SeparatorMap[p.prefix] : ","));
|
|
236
236
|
}
|
|
237
|
-
} else if (typeof x === "object") {
|
|
237
|
+
} else if (x != null && typeof x === "object") {
|
|
238
238
|
if (Object.keys(x).length) {
|
|
239
239
|
vs.push((v.repeat ? "" : pre) + Object.entries(x).map((([ok, ov]) => `${esc(ok)}${v.repeat ? "=" : ","}${esc(ov)}`)).join(v.repeat ? SeparatorMap[p.prefix] : ","));
|
|
240
240
|
}
|
package/dist/uri-template.d.ts
CHANGED
|
@@ -32,18 +32,19 @@ type MapItem = {
|
|
|
32
32
|
} | {
|
|
33
33
|
type: VarType.STATIC;
|
|
34
34
|
};
|
|
35
|
-
export declare class UriTemplate {
|
|
35
|
+
export declare class UriTemplate<P extends UriParams> {
|
|
36
36
|
expandParts: TemplateParts;
|
|
37
37
|
matchRegex: RegExp;
|
|
38
38
|
matchMap: Map<string, MapItem>;
|
|
39
39
|
constructor(template: string);
|
|
40
|
-
expand(variables:
|
|
41
|
-
match(url: string): UriMatch | null;
|
|
40
|
+
expand(variables: P): string;
|
|
41
|
+
match(url: string): UriMatch<P> | null;
|
|
42
42
|
}
|
|
43
|
-
export type UrlParamValue = string | number | string[] | number[] | Record<string, string | number | null>;
|
|
44
|
-
|
|
45
|
-
export type
|
|
43
|
+
export type UrlParamValue = string | number | boolean | string[] | number[] | Record<string, string | number | boolean | null>;
|
|
44
|
+
type NullableUrlParamValue = UrlParamValue | null;
|
|
45
|
+
export type UriParams = Record<string, NullableUrlParamValue>;
|
|
46
|
+
export type UriMatch<P extends UriParams> = {
|
|
46
47
|
score: number;
|
|
47
|
-
params:
|
|
48
|
+
params: P;
|
|
48
49
|
};
|
|
49
50
|
export {};
|