1
0
mirror of https://github.com/misskey-dev/misskey synced 2024-11-28 23:09:16 +09:00

Merge pull request #2498 from syuilo/ends-with

Use endsWith for readability
This commit is contained in:
syuilo 2018-08-26 14:03:06 +09:00 committed by GitHub
commit 78ba305e5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View File

@ -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;
}

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

View File

@ -7,7 +7,7 @@ function trim(text, g) {
export default function(src) {
const fn = options => {
const search = options.search;
const g = search[search.length - 1] == 'g';
const g = search.endsWith('g');
const file = this.resourcePath.replace(/\\/g, '/');
const replace = options.i18n ? global[options.replace].bind(null, {
src: file,