// 判断两个路由是否是匹配关系
export function isMatchRoute(source: string, target: string) {
  if (source.endsWith('/*')) {
    return target.startsWith(source.slice(0, -2));
  }
  const sources = source.split('/');
  const targets = target.split('/');
  if (sources.length !== targets.length) return false;
  return sources.every((item, i) => {
    if (item.startsWith(':')) return true;
    return item === targets[i];
  });
}
