Use endsWith for readability

This commit is contained in:
Aya Morisawa 2018-08-26 13:55:39 +09:00
parent 3e20ea5b2e
commit bfed1475bb
No known key found for this signature in database
GPG key ID: 3E64865D70D579F2
3 changed files with 3 additions and 3 deletions

View file

@ -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'];