mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-12-23 19:43:08 +02:00
Use endsWith for readability
This commit is contained in:
parent
3e20ea5b2e
commit
bfed1475bb
3 changed files with 3 additions and 3 deletions
|
@ -53,5 +53,5 @@ export default function load() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function normalizeUrl(url: string) {
|
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 compareOrigin(ctx: Koa.Context) {
|
||||||
function normalizeUrl(url: string) {
|
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'];
|
const referer = ctx.headers['referer'];
|
||||||
|
|
|
@ -7,7 +7,7 @@ function trim(text, g) {
|
||||||
export default function(src) {
|
export default function(src) {
|
||||||
const fn = options => {
|
const fn = options => {
|
||||||
const search = options.search;
|
const search = options.search;
|
||||||
const g = search[search.length - 1] == 'g';
|
const g = search.endsWith('g');
|
||||||
const file = this.resourcePath.replace(/\\/g, '/');
|
const file = this.resourcePath.replace(/\\/g, '/');
|
||||||
const replace = options.i18n ? global[options.replace].bind(null, {
|
const replace = options.i18n ? global[options.replace].bind(null, {
|
||||||
src: file,
|
src: file,
|
||||||
|
|
Loading…
Reference in a new issue