Use endsWith for readability
This commit is contained in:
@ -53,5 +53,5 @@ export default function load() {
|
||||
}
|
||||
|
||||
function normalizeUrl(url: string) {
|
||||
return url[url.length - 1] === '/' ? url.substr(0, url.length - 1) : url;
|
||||
return url.endsWith('/') ? url.substr(0, url.length - 1) : url;
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ function getUserToken(ctx: Koa.Context) {
|
||||
|
||||
function compareOrigin(ctx: Koa.Context) {
|
||||
function normalizeUrl(url: string) {
|
||||
return url[url.length - 1] === '/' ? url.substr(0, url.length - 1) : url;
|
||||
return url.endsWith('/') ? url.substr(0, url.length - 1) : url;
|
||||
}
|
||||
|
||||
const referer = ctx.headers['referer'];
|
||||
|
Reference in New Issue
Block a user