mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-10 00:27:41 +08:00
fix(router): simplify param merging (#22999)
This commit is contained in:
@ -82,18 +82,10 @@ export const matchesPath = (inputPath: string[], chain: RouteChain): RouteChain
|
|||||||
return chain;
|
return chain;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const mergeParams = (a: any, b: any): any => {
|
// Merges the route parameter objects.
|
||||||
if (!a && b) {
|
// Returns undefined when both parameters are undefined.
|
||||||
return b;
|
export const mergeParams = (a: {[key: string]: any} | undefined, b: {[key: string]: any} | undefined): {[key: string]: any} | undefined => {
|
||||||
} else if (a && !b) {
|
return a || b ? { ...a, ...b } : undefined;
|
||||||
return a;
|
|
||||||
} else if (a && b) {
|
|
||||||
return {
|
|
||||||
...a,
|
|
||||||
...b
|
|
||||||
};
|
|
||||||
}
|
|
||||||
return undefined;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const routerIDsToChain = (ids: RouteID[], chains: RouteChain[]): RouteChain | null => {
|
export const routerIDsToChain = (ids: RouteID[], chains: RouteChain[]): RouteChain | null => {
|
||||||
|
|||||||
Reference in New Issue
Block a user