Skip to content

Function: createRoutePattern() ​

ts
function createRoutePattern(path): string;

Converts a react-router style path with :param into a regex pattern segment. 把 react-router 风格的路径参数 :id 转换为正则匹配片段。

Parameters ​

ParameterTypeDescription
pathstringRoute path / 路由路径

Returns ​

string

Regex-compatible pattern / 正则匹配片段

Since ​

1.3.0

Released under the MIT License.