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,
|
credentials,
|
||||||
}) => {
|
}) => {
|
||||||
const payload = {}
|
const payload = {}
|
||||||
if (typeof sensitive !== 'undefined') {
|
if (sensitive !== undefined) {
|
||||||
payload['sensitive'] = sensitive
|
payload['sensitive'] = sensitive
|
||||||
}
|
}
|
||||||
if (typeof visibility !== 'undefined') {
|
if (visibility !== undefined) {
|
||||||
payload['visibility'] = visibility
|
payload['visibility'] = visibility
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -260,15 +260,15 @@ export const announcementToPayload = ({
|
||||||
}) => {
|
}) => {
|
||||||
const payload = { content }
|
const payload = { content }
|
||||||
|
|
||||||
if (typeof startsAt !== 'undefined') {
|
if (startsAt !== undefined) {
|
||||||
payload.starts_at = startsAt ? new Date(startsAt).toISOString() : null
|
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
|
payload.ends_at = endsAt ? new Date(endsAt).toISOString() : null
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof allDay !== 'undefined') {
|
if (allDay !== undefined) {
|
||||||
payload.all_day = allDay
|
payload.all_day = allDay
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ export const paramsString = (params = {}) => {
|
||||||
if (
|
if (
|
||||||
typeof v === 'object' ||
|
typeof v === 'object' ||
|
||||||
typeof v === 'function' ||
|
typeof v === 'function' ||
|
||||||
typeof v === 'undefined'
|
v === undefined
|
||||||
)
|
)
|
||||||
throw new TypeError('Array param cannot contain non-primitives!')
|
throw new TypeError('Array param cannot contain non-primitives!')
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ const Chat = {
|
||||||
mounted() {
|
mounted() {
|
||||||
window.addEventListener('resize', this.handleResize)
|
window.addEventListener('resize', this.handleResize)
|
||||||
window.addEventListener('scroll', this.handleScroll)
|
window.addEventListener('scroll', this.handleScroll)
|
||||||
if (typeof document.hidden !== 'undefined') {
|
if (document.hidden !== undefined) {
|
||||||
document.addEventListener(
|
document.addEventListener(
|
||||||
'visibilitychange',
|
'visibilitychange',
|
||||||
this.handleVisibilityChange,
|
this.handleVisibilityChange,
|
||||||
|
|
@ -112,7 +112,7 @@ const Chat = {
|
||||||
unmounted() {
|
unmounted() {
|
||||||
window.removeEventListener('scroll', this.handleScroll)
|
window.removeEventListener('scroll', this.handleScroll)
|
||||||
window.removeEventListener('resize', this.handleResize)
|
window.removeEventListener('resize', this.handleResize)
|
||||||
if (typeof document.hidden !== 'undefined')
|
if (document.hidden !== undefined)
|
||||||
document.removeEventListener(
|
document.removeEventListener(
|
||||||
'visibilitychange',
|
'visibilitychange',
|
||||||
this.handleVisibilityChange,
|
this.handleVisibilityChange,
|
||||||
|
|
|
||||||
|
|
@ -11,11 +11,11 @@
|
||||||
{{ label }}
|
{{ label }}
|
||||||
</label>
|
</label>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
v-if="typeof fallback !== 'undefined' && showOptionalCheckbox && !hideOptionalCheckbox"
|
v-if="fallback !== undefined && showOptionalCheckbox && !hideOptionalCheckbox"
|
||||||
:model-value="present"
|
:model-value="present"
|
||||||
:disabled="disabled"
|
:disabled="disabled"
|
||||||
class="opt"
|
class="opt"
|
||||||
@update:model-value="updateValue(typeof modelValue === 'undefined' ? fallback : undefined)"
|
@update:model-value="updateValue(modelValue === undefined ? fallback : undefined)"
|
||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
class="input color-input-field"
|
class="input color-input-field"
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
<div class="font-control">
|
<div class="font-control">
|
||||||
<div class="setting-item">
|
<div class="setting-item">
|
||||||
<Checkbox
|
<Checkbox
|
||||||
v-if="typeof fallback !== 'undefined'"
|
v-if="fallback !== undefined"
|
||||||
:id="name + '-o'"
|
:id="name + '-o'"
|
||||||
class="font-checkbox setting-control setting-label"
|
class="font-checkbox setting-control setting-label"
|
||||||
:model-value="present"
|
:model-value="present"
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
{{ label || $t('settings.style.themes3.editor.opacity') }}
|
{{ label || $t('settings.style.themes3.editor.opacity') }}
|
||||||
</label>
|
</label>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
v-if="typeof fallback !== 'undefined'"
|
v-if="fallback !== undefined"
|
||||||
:model-value="present"
|
:model-value="present"
|
||||||
:disabled="disabled"
|
:disabled="disabled"
|
||||||
class="opt"
|
class="opt"
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
{{ label }}
|
{{ label }}
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
v-if="typeof fallback !== 'undefined'"
|
v-if="fallback !== undefined"
|
||||||
:id="name + '-o'"
|
:id="name + '-o'"
|
||||||
:aria-labelledby="name + '-label'"
|
:aria-labelledby="name + '-label'"
|
||||||
class="input -checkbox opt visible-for-screenreader-only"
|
class="input -checkbox opt visible-for-screenreader-only"
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
@change="$emit('update:modelValue', !present ? fallback : undefined)"
|
@change="$emit('update:modelValue', !present ? fallback : undefined)"
|
||||||
>
|
>
|
||||||
<label
|
<label
|
||||||
v-if="typeof fallback !== 'undefined'"
|
v-if="fallback !== undefined"
|
||||||
class="opt-l"
|
class="opt-l"
|
||||||
:for="name + '-o'"
|
:for="name + '-o'"
|
||||||
:aria-hidden="true"
|
:aria-hidden="true"
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
{{ label }}
|
{{ label }}
|
||||||
</label>
|
</label>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
v-if="typeof fallback !== 'undefined'"
|
v-if="fallback !== undefined"
|
||||||
:model-value="present"
|
:model-value="present"
|
||||||
:disabled="disabled"
|
:disabled="disabled"
|
||||||
class="opt"
|
class="opt"
|
||||||
|
|
|
||||||
|
|
@ -611,7 +611,7 @@ export default {
|
||||||
*/
|
*/
|
||||||
normalizeLocalState(theme, version = 0, source, forceSource = false) {
|
normalizeLocalState(theme, version = 0, source, forceSource = false) {
|
||||||
let input
|
let input
|
||||||
if (typeof source !== 'undefined') {
|
if (source !== undefined) {
|
||||||
if (forceSource || source?.themeEngineVersion === CURRENT_VERSION) {
|
if (forceSource || source?.themeEngineVersion === CURRENT_VERSION) {
|
||||||
input = source
|
input = source
|
||||||
version = source.themeEngineVersion
|
version = source.themeEngineVersion
|
||||||
|
|
|
||||||
|
|
@ -181,14 +181,14 @@
|
||||||
name="accentColor"
|
name="accentColor"
|
||||||
:fallback="previewTheme.colors?.link"
|
:fallback="previewTheme.colors?.link"
|
||||||
:label="$t('settings.accent')"
|
:label="$t('settings.accent')"
|
||||||
:show-optional-checkbox="typeof linkColorLocal !== 'undefined'"
|
:show-optional-checkbox="linkColorLocal !== undefined"
|
||||||
/>
|
/>
|
||||||
<ColorInput
|
<ColorInput
|
||||||
v-model="linkColorLocal"
|
v-model="linkColorLocal"
|
||||||
name="linkColor"
|
name="linkColor"
|
||||||
:fallback="previewTheme.colors?.accent"
|
:fallback="previewTheme.colors?.accent"
|
||||||
:label="$t('settings.links')"
|
:label="$t('settings.links')"
|
||||||
:show-optional-checkbox="typeof accentColorLocal !== 'undefined'"
|
:show-optional-checkbox="accentColorLocal !== undefined"
|
||||||
/>
|
/>
|
||||||
<ContrastRatio :contrast="previewContrast.bgLink" />
|
<ContrastRatio :contrast="previewContrast.bgLink" />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
const arg = process.argv[2]
|
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('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('outputs all the things present in english but missing in foreign language.')
|
||||||
console.info('')
|
console.info('')
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ export default function createPersistedState({
|
||||||
if (saveImmedeatelyActions.includes(mutation.type)) {
|
if (saveImmedeatelyActions.includes(mutation.type)) {
|
||||||
setState(key, reducer(cloneDeep(state), paths), storage).then(
|
setState(key, reducer(cloneDeep(state), paths), storage).then(
|
||||||
(success) => {
|
(success) => {
|
||||||
if (typeof success !== 'undefined') {
|
if (success !== undefined) {
|
||||||
if (
|
if (
|
||||||
mutation.type === 'setOption' ||
|
mutation.type === 'setOption' ||
|
||||||
mutation.type === 'setCurrentUser'
|
mutation.type === 'setCurrentUser'
|
||||||
|
|
|
||||||
|
|
@ -325,7 +325,7 @@ const api = {
|
||||||
const token = state.wsToken
|
const token = state.wsToken
|
||||||
if (
|
if (
|
||||||
useInstanceCapabilitiesStore().shoutAvailable &&
|
useInstanceCapabilitiesStore().shoutAvailable &&
|
||||||
typeof token !== 'undefined' &&
|
token !== undefined &&
|
||||||
state.socket === null
|
state.socket === null
|
||||||
) {
|
) {
|
||||||
const socket = new Socket('/socket', { params: { token } })
|
const socket = new Socket('/socket', { params: { token } })
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ import { contrastRatio, convert, invertLightness } from 'chromatism'
|
||||||
* @param {Number} [b] - Blue component
|
* @param {Number} [b] - Blue component
|
||||||
*/
|
*/
|
||||||
export const rgb2hex = (r, g, b) => {
|
export const rgb2hex = (r, g, b) => {
|
||||||
if (r === null || typeof r === 'undefined') {
|
if (r === null || r === undefined) {
|
||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
// TODO: clean up this mess
|
// TODO: clean up this mess
|
||||||
|
|
@ -130,7 +130,7 @@ export const arithmeticBlend = (origin, value, operator) => {
|
||||||
* @returns {Object} sRGB of resulting color
|
* @returns {Object} sRGB of resulting color
|
||||||
*/
|
*/
|
||||||
export const alphaBlend = (fg, fga, bg) => {
|
export const alphaBlend = (fg, fga, bg) => {
|
||||||
if (fga === 1 || typeof fga === 'undefined') {
|
if (fga === 1 || fga === undefined) {
|
||||||
return fg
|
return fg
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@ const _verifyPrefs = (state) => {
|
||||||
|
|
||||||
// Simple
|
// Simple
|
||||||
Object.entries(defaultState.prefsStorage.simple).forEach(([k, v]) => {
|
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 === 'number' || typeof v === 'boolean') return
|
||||||
if (typeof v === 'object') return
|
if (typeof v === 'object') return
|
||||||
console.warn(
|
console.warn(
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ const _verifyHighlights = (state) => {
|
||||||
|
|
||||||
// Simple
|
// Simple
|
||||||
Object.entries(defaultState.highlight).forEach(([k, v]) => {
|
Object.entries(defaultState.highlight).forEach(([k, v]) => {
|
||||||
if (typeof v === 'undefined') return
|
if (v === undefined) return
|
||||||
if (typeof v === 'object') return
|
if (typeof v === 'object') return
|
||||||
console.warn(`User highlight ${k} is invalid type ${typeof v}, unsetting`)
|
console.warn(`User highlight ${k} is invalid type ${typeof v}, unsetting`)
|
||||||
delete state.highlight[k]
|
delete state.highlight[k]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue