function matchParams() {
  var rawPath = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
  var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  return rawPath.replace(/:(\w+)\???(?=$|\/)/g, function (a, b) {
    if (params[b]) {
      return params[b];
    }
    return '';
  });
}
/**
 * 小程序下，获取对应的 H5 路由信息
 * @param {Object} route 路由信息
 * @returns H5 Url
 * @example
 * ```ts
 * getH5CurrentUrl(this.$route);
 * ```
 */
function getH5CurrentUrl(route) {
  var _route$name = route.name,
    name = _route$name === void 0 ? '' : _route$name,
    meta = route.meta,
    params = route.params;
  var _ref = meta || {},
    _ref$rawPath = _ref.rawPath,
    rawPath = _ref$rawPath === void 0 ? [] : _ref$rawPath;
  if (!Object.keys(params).length || !rawPath.length) {
    return "/".concat(name);
  }
  return matchParams(rawPath[0], params);
}

export { getH5CurrentUrl, matchParams };
