diff --git a/src/api/admin.js b/src/api/admin.js index d4a9e8ff9..8bbee8b4f 100644 --- a/src/api/admin.js +++ b/src/api/admin.js @@ -237,10 +237,10 @@ export const changeStatusScope = ({ credentials, }) => { const payload = {} - if (typeof sensitive !== 'undefined') { + if (sensitive !== undefined) { payload['sensitive'] = sensitive } - if (typeof visibility !== 'undefined') { + if (visibility !== undefined) { payload['visibility'] = visibility } @@ -260,15 +260,15 @@ export const announcementToPayload = ({ }) => { const payload = { content } - if (typeof startsAt !== 'undefined') { + if (startsAt !== undefined) { payload.starts_at = startsAt ? new Date(startsAt).toISOString() : null } - if (typeof endsAt !== 'undefined') { + if (endsAt !== undefined) { payload.ends_at = endsAt ? new Date(endsAt).toISOString() : null } - if (typeof allDay !== 'undefined') { + if (allDay !== undefined) { payload.all_day = allDay } diff --git a/src/api/helpers.js b/src/api/helpers.js index cb2f2bdd5..22ba41ecb 100644 --- a/src/api/helpers.js +++ b/src/api/helpers.js @@ -40,7 +40,7 @@ export const paramsString = (params = {}) => { if ( typeof v === 'object' || typeof v === 'function' || - typeof v === 'undefined' + v === undefined ) throw new TypeError('Array param cannot contain non-primitives!') }) diff --git a/src/components/chat_view/chat_view.js b/src/components/chat_view/chat_view.js index f48b75c65..16b2ae1d7 100644 --- a/src/components/chat_view/chat_view.js +++ b/src/components/chat_view/chat_view.js @@ -97,7 +97,7 @@ const Chat = { mounted() { window.addEventListener('resize', this.handleResize) window.addEventListener('scroll', this.handleScroll) - if (typeof document.hidden !== 'undefined') { + if (document.hidden !== undefined) { document.addEventListener( 'visibilitychange', this.handleVisibilityChange, @@ -112,7 +112,7 @@ const Chat = { unmounted() { window.removeEventListener('scroll', this.handleScroll) window.removeEventListener('resize', this.handleResize) - if (typeof document.hidden !== 'undefined') + if (document.hidden !== undefined) document.removeEventListener( 'visibilitychange', this.handleVisibilityChange, diff --git a/src/components/color_input/color_input.vue b/src/components/color_input/color_input.vue index d6667c28f..53396f532 100644 --- a/src/components/color_input/color_input.vue +++ b/src/components/color_input/color_input.vue @@ -11,11 +11,11 @@ {{ label }}
diff --git a/src/i18n/compare b/src/i18n/compare index 94e5aab55..7afe9355c 100755 --- a/src/i18n/compare +++ b/src/i18n/compare @@ -1,7 +1,7 @@ #!/usr/bin/env node const arg = process.argv[2] -if (typeof arg === 'undefined') { +if (arg === undefined) { console.info('This is a very simple and tiny tool that checks en.json with any other language and') console.info('outputs all the things present in english but missing in foreign language.') console.info('') diff --git a/src/lib/persisted_state.js b/src/lib/persisted_state.js index aef1cc8dc..b4d6c596d 100644 --- a/src/lib/persisted_state.js +++ b/src/lib/persisted_state.js @@ -74,7 +74,7 @@ export default function createPersistedState({ if (saveImmedeatelyActions.includes(mutation.type)) { setState(key, reducer(cloneDeep(state), paths), storage).then( (success) => { - if (typeof success !== 'undefined') { + if (success !== undefined) { if ( mutation.type === 'setOption' || mutation.type === 'setCurrentUser' diff --git a/src/modules/api.js b/src/modules/api.js index 92b849a2b..d2c578c9c 100644 --- a/src/modules/api.js +++ b/src/modules/api.js @@ -325,7 +325,7 @@ const api = { const token = state.wsToken if ( useInstanceCapabilitiesStore().shoutAvailable && - typeof token !== 'undefined' && + token !== undefined && state.socket === null ) { const socket = new Socket('/socket', { params: { token } }) diff --git a/src/services/color_convert/color_convert.js b/src/services/color_convert/color_convert.js index 768552b1c..925969531 100644 --- a/src/services/color_convert/color_convert.js +++ b/src/services/color_convert/color_convert.js @@ -11,7 +11,7 @@ import { contrastRatio, convert, invertLightness } from 'chromatism' * @param {Number} [b] - Blue component */ export const rgb2hex = (r, g, b) => { - if (r === null || typeof r === 'undefined') { + if (r === null || r === undefined) { return undefined } // TODO: clean up this mess @@ -130,7 +130,7 @@ export const arithmeticBlend = (origin, value, operator) => { * @returns {Object} sRGB of resulting color */ export const alphaBlend = (fg, fga, bg) => { - if (fga === 1 || typeof fga === 'undefined') { + if (fga === 1 || fga === undefined) { return fg } diff --git a/src/stores/sync_config.js b/src/stores/sync_config.js index fb1450c18..9464ffb68 100644 --- a/src/stores/sync_config.js +++ b/src/stores/sync_config.js @@ -104,7 +104,7 @@ const _verifyPrefs = (state) => { // Simple Object.entries(defaultState.prefsStorage.simple).forEach(([k, v]) => { - if (typeof v === 'undefined') return + if (v === undefined) return if (typeof v === 'number' || typeof v === 'boolean') return if (typeof v === 'object') return console.warn( diff --git a/src/stores/user_highlight.js b/src/stores/user_highlight.js index 0db37703d..3cd3bfe7d 100644 --- a/src/stores/user_highlight.js +++ b/src/stores/user_highlight.js @@ -43,7 +43,7 @@ const _verifyHighlights = (state) => { // Simple Object.entries(defaultState.highlight).forEach(([k, v]) => { - if (typeof v === 'undefined') return + if (v === undefined) return if (typeof v === 'object') return console.warn(`User highlight ${k} is invalid type ${typeof v}, unsetting`) delete state.highlight[k]