refactor: Use ===

This commit is contained in:
syuilo 2020-04-04 08:46:54 +09:00
parent fef5ec874b
commit d4a630902d
39 changed files with 69 additions and 69 deletions

View file

@ -310,7 +310,7 @@ export default Vue.extend({
title: this.$t('search'),
input: true
}).then(async ({ canceled, result: query }) => {
if (canceled || query == null || query == '') return;
if (canceled || query == null || query === '') return;
this.searching = true;
search(this, query).finally(() => {
@ -320,7 +320,7 @@ export default Vue.extend({
},
searchKeypress(e) {
if (e.keyCode == 13) {
if (e.keyCode === 13) {
this.searchWait = true;
search(this, this.searchQuery).finally(() => {
this.searchWait = false;

View file

@ -197,7 +197,7 @@ export default class MiOS extends EventEmitter {
// When subscribe failed
.catch(async (err: Error) => {
// 通知が許可されていなかったとき
if (err.name == 'NotAllowedError') {
if (err.name === 'NotAllowedError') {
return;
}

View file

@ -57,9 +57,9 @@ const ignoreElemens = ['input', 'textarea'];
function match(e: KeyboardEvent, patterns: action['patterns']): boolean {
const key = e.code.toLowerCase();
return patterns.some(pattern => pattern.which.includes(key) &&
pattern.ctrl == e.ctrlKey &&
pattern.shift == e.shiftKey &&
pattern.alt == e.altKey &&
pattern.ctrl === e.ctrlKey &&
pattern.shift === e.shiftKey &&
pattern.alt === e.altKey &&
!e.metaKey
);
}

View file

@ -1,5 +1,5 @@
export default (input: string): string[] => {
if (Object.keys(aliases).some(a => a.toLowerCase() == input.toLowerCase())) {
if (Object.keys(aliases).some(a => a.toLowerCase() === input.toLowerCase())) {
const codes = aliases[input];
return Array.isArray(codes) ? codes : [codes];
} else {

View file

@ -20,7 +20,7 @@ export default (opts) => ({
computed: {
empty(): boolean {
return this.items.length == 0 && !this.fetching && this.inited;
return this.items.length === 0 && !this.fetching && this.inited;
},
error(): boolean {

View file

@ -47,9 +47,9 @@ export async function search(v: any, q: string) {
uri: q
});
dialog.close();
if (res.type == 'User') {
if (res.type === 'User') {
v.$router.push(`/@${res.object.username}@${res.object.host}`);
} else if (res.type == 'Note') {
} else if (res.type === 'Note') {
v.$router.push(`/notes/${res.object.id}`);
}
} catch (e) {

View file

@ -68,7 +68,7 @@ export default class Stream extends EventEmitter {
*/
@autobind
private onOpen() {
const isReconnect = this.state == 'reconnecting';
const isReconnect = this.state === 'reconnecting';
this.state = 'connected';
this.emit('_connected_');
@ -87,7 +87,7 @@ export default class Stream extends EventEmitter {
*/
@autobind
private onClose() {
if (this.state == 'connected') {
if (this.state === 'connected') {
this.state = 'reconnecting';
this.emit('_disconnected_');
}
@ -100,7 +100,7 @@ export default class Stream extends EventEmitter {
private onMessage(message) {
const { type, body } = JSON.parse(message.data);
if (type == 'channel') {
if (type === 'channel') {
const id = body.id;
let connections: Connection[];

View file

@ -257,7 +257,7 @@ export default () => new Vuex.Store({
},
updateWidget(state, x) {
const w = state.widgets.find(w => w.id == x.id);
const w = state.widgets.find(w => w.id === x.id);
if (w) {
w.data = x.data;
}

View file

@ -51,14 +51,14 @@ export default Vue.extend({
weekday: date.getDay()
};
d.v = peak == 0 ? 0 : d.total / (peak / 2);
d.v = peak === 0 ? 0 : d.total / (peak / 2);
if (d.v > 1) d.v = 1;
const ch = d.date.weekday == 0 || d.date.weekday == 6 ? 275 : 170;
const ch = d.date.weekday === 0 || d.date.weekday === 6 ? 275 : 170;
const cs = d.v * 100;
const cl = 15 + ((1 - d.v) * 80);
d.color = `hsl(${ch}, ${cs}%, ${cl}%)`;
if (d.date.weekday == 0) x--;
if (d.date.weekday === 0) x--;
});
}
});

View file

@ -60,7 +60,7 @@ export default define({
},
methods: {
func() {
if (this.props.design == 2) {
if (this.props.design === 2) {
this.props.design = 0;
} else {
this.props.design++;
@ -68,7 +68,7 @@ export default define({
this.save();
},
toggleView() {
if (this.props.view == 1) {
if (this.props.view === 1) {
this.props.view = 0;
} else {
this.props.view++;

View file

@ -65,7 +65,7 @@ export default define({
},
methods: {
func() {
if (this.props.design == 2) {
if (this.props.design === 2) {
this.props.design = 0;
} else {
this.props.design++;
@ -102,7 +102,7 @@ export default define({
this.monthP = monthNumer / monthDenom * 100;
this.yearP = yearNumer / yearDenom * 100;
this.isHoliday = now.getDay() == 0 || now.getDay() == 6;
this.isHoliday = now.getDay() === 0 || now.getDay() === 6;
}
}
});

View file

@ -1,6 +1,6 @@
<template>
<div>
<mk-container :show-header="props.design === 0" :naked="props.design === 2" :class="$style.root" :data-melt="props.design == 2">
<mk-container :show-header="props.design === 0" :naked="props.design === 2" :class="$style.root" :data-melt="props.design === 2">
<template #header><fa :icon="faCamera"/>{{ $t('_widgets.photos') }}</template>
<div class="">
@ -66,7 +66,7 @@ export default define({
},
func() {
if (this.props.design == 2) {
if (this.props.design === 2) {
this.props.design = 0;
} else {
this.props.design++;