undefineds
This commit is contained in:
parent
f39a3eeb32
commit
f16e19d2b2
16 changed files with 25 additions and 25 deletions
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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!')
|
||||
})
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -11,11 +11,11 @@
|
|||
{{ label }}
|
||||
</label>
|
||||
<Checkbox
|
||||
v-if="typeof fallback !== 'undefined' && showOptionalCheckbox && !hideOptionalCheckbox"
|
||||
v-if="fallback !== undefined && showOptionalCheckbox && !hideOptionalCheckbox"
|
||||
:model-value="present"
|
||||
:disabled="disabled"
|
||||
class="opt"
|
||||
@update:model-value="updateValue(typeof modelValue === 'undefined' ? fallback : undefined)"
|
||||
@update:model-value="updateValue(modelValue === undefined ? fallback : undefined)"
|
||||
/>
|
||||
<div
|
||||
class="input color-input-field"
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<div class="font-control">
|
||||
<div class="setting-item">
|
||||
<Checkbox
|
||||
v-if="typeof fallback !== 'undefined'"
|
||||
v-if="fallback !== undefined"
|
||||
:id="name + '-o'"
|
||||
class="font-checkbox setting-control setting-label"
|
||||
:model-value="present"
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
{{ label || $t('settings.style.themes3.editor.opacity') }}
|
||||
</label>
|
||||
<Checkbox
|
||||
v-if="typeof fallback !== 'undefined'"
|
||||
v-if="fallback !== undefined"
|
||||
:model-value="present"
|
||||
:disabled="disabled"
|
||||
class="opt"
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
{{ label }}
|
||||
</label>
|
||||
<input
|
||||
v-if="typeof fallback !== 'undefined'"
|
||||
v-if="fallback !== undefined"
|
||||
:id="name + '-o'"
|
||||
:aria-labelledby="name + '-label'"
|
||||
class="input -checkbox opt visible-for-screenreader-only"
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
@change="$emit('update:modelValue', !present ? fallback : undefined)"
|
||||
>
|
||||
<label
|
||||
v-if="typeof fallback !== 'undefined'"
|
||||
v-if="fallback !== undefined"
|
||||
class="opt-l"
|
||||
:for="name + '-o'"
|
||||
:aria-hidden="true"
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
{{ label }}
|
||||
</label>
|
||||
<Checkbox
|
||||
v-if="typeof fallback !== 'undefined'"
|
||||
v-if="fallback !== undefined"
|
||||
:model-value="present"
|
||||
:disabled="disabled"
|
||||
class="opt"
|
||||
|
|
|
|||
|
|
@ -611,7 +611,7 @@ export default {
|
|||
*/
|
||||
normalizeLocalState(theme, version = 0, source, forceSource = false) {
|
||||
let input
|
||||
if (typeof source !== 'undefined') {
|
||||
if (source !== undefined) {
|
||||
if (forceSource || source?.themeEngineVersion === CURRENT_VERSION) {
|
||||
input = source
|
||||
version = source.themeEngineVersion
|
||||
|
|
|
|||
|
|
@ -181,14 +181,14 @@
|
|||
name="accentColor"
|
||||
:fallback="previewTheme.colors?.link"
|
||||
:label="$t('settings.accent')"
|
||||
:show-optional-checkbox="typeof linkColorLocal !== 'undefined'"
|
||||
:show-optional-checkbox="linkColorLocal !== undefined"
|
||||
/>
|
||||
<ColorInput
|
||||
v-model="linkColorLocal"
|
||||
name="linkColor"
|
||||
:fallback="previewTheme.colors?.accent"
|
||||
:label="$t('settings.links')"
|
||||
:show-optional-checkbox="typeof accentColorLocal !== 'undefined'"
|
||||
:show-optional-checkbox="accentColorLocal !== undefined"
|
||||
/>
|
||||
<ContrastRatio :contrast="previewContrast.bgLink" />
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -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('')
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
|
|
|
|||
|
|
@ -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 } })
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue