Skip to content

Function: normalizeRedirect() ​

ts
function normalizeRedirect(redirect): string;

规范化 redirect 路径:去掉 hash,合并开头多余的 /。

Parameters ​

ParameterType
redirectstring

Returns ​

string

Example ​

ts
normalizeRedirect('/page#section')  // => /page
normalizeRedirect('///user')        // => /user
normalizeRedirect('/page?foo=1')    // => /page?foo=1
normalizeRedirect('')               // => /

Released under the MIT License.