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;
|
||||
};
|
||||
|
||||
export const mergeParams = (a: any, b: any): any => {
|
||||
if (!a && b) {
|
||||
return b;
|
||||
} else if (a && !b) {
|
||||
return a;
|
||||
} else if (a && b) {
|
||||
return {
|
||||
...a,
|
||||
...b
|
||||
};
|
||||
}
|
||||
return undefined;
|
||||
// Merges the route parameter objects.
|
||||
// Returns undefined when both parameters are undefined.
|
||||
export const mergeParams = (a: {[key: string]: any} | undefined, b: {[key: string]: any} | undefined): {[key: string]: any} | undefined => {
|
||||
return a || b ? { ...a, ...b } : undefined;
|
||||
};
|
||||
|
||||
export const routerIDsToChain = (ids: RouteID[], chains: RouteChain[]): RouteChain | null => {
|
||||
|
||||
Reference in New Issue
Block a user