undefined typeof

This commit is contained in:
Henry Jameson 2026-08-04 00:31:24 +03:00
commit 0eb63de209
13 changed files with 25 additions and 25 deletions

View file

@ -409,7 +409,7 @@ const getNodeInfo = async ({ store }) => {
useInstanceCapabilitiesStore().set(
'tagPolicyAvailable',
typeof federation.mrf_policies === 'undefined'
federation.mrf_policies === undefined
? false
: metadata.federation.mrf_policies.includes('TagPolicy'),
)
@ -421,7 +421,7 @@ const getNodeInfo = async ({ store }) => {
useInstanceStore().set({
path: 'federating',
value:
typeof federation.enabled === 'undefined' ? true : federation.enabled,
federation.enabled === undefined ? true : federation.enabled,
})
const accountActivationRequired = metadata.accountActivationRequired
@ -547,7 +547,7 @@ const afterStoreSetup = async ({ pinia, store, storageError, i18n }) => {
const overrides = window.___pleromafe_dev_overrides || {}
const server =
typeof overrides.target !== 'undefined'
overrides.target !== undefined
? overrides.target
: window.location.origin
useInstanceStore().set({ path: 'server', value: server })

View file

@ -59,7 +59,7 @@ const Chat = {
},
mounted() {
window.addEventListener('scroll', this.handleScroll)
if (typeof document.hidden !== 'undefined') {
if (document.hidden !== undefined) {
document.addEventListener(
'visibilitychange',
this.handleVisibilityChange,
@ -74,7 +74,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,

View file

@ -134,7 +134,7 @@ export default {
emits: ['update:modelValue'],
computed: {
present() {
return typeof this.modelValue !== 'undefined'
return this.modelValue !== undefined
},
validColor() {
return hex2rgb(this.modelValue || this.fallback)

View file

@ -42,7 +42,7 @@ export default {
emits: ['update:modelValue'],
computed: {
present() {
return typeof this.modelValue !== 'undefined'
return this.modelValue !== undefined
},
},
}

View file

@ -68,7 +68,7 @@ export default {
emits: ['update:modelValue'],
computed: {
present() {
return typeof this.modelValue !== 'undefined'
return this.modelValue !== undefined
},
},
}

View file

@ -42,7 +42,7 @@ export default {
emits: ['update:modelValue'],
computed: {
present() {
return typeof this.modelValue !== 'undefined'
return this.modelValue !== undefined
},
},
}

View file

@ -159,7 +159,7 @@ export default {
return this.source || this.defaultSource
},
realDraftMode() {
return typeof this.draftMode === 'undefined'
return this.draftMode === undefined
? this.defaultDraftMode
: this.draftMode
},

View file

@ -147,7 +147,7 @@ export default {
})
},
mounted() {
if (typeof this.shadowSelected === 'undefined') {
if (this.shadowSelected === undefined) {
this.shadowSelected = this.shadowsAvailable[0]
}
},
@ -634,15 +634,15 @@ export default {
if (input.version) version = input.version
// Old v1 naming: fg is text, btn is foreground
if (
typeof colors.text === 'undefined' &&
typeof colors.fg !== 'undefined'
colors.text === undefined &&
colors.fg !== undefined
) {
version = 1
}
// New v2 naming: text is text, fg is foreground
if (
typeof colors.text !== 'undefined' &&
typeof colors.fg !== 'undefined'
colors.text !== undefined &&
colors.fg !== undefined
) {
version = 2
}
@ -679,7 +679,7 @@ export default {
if (opacity && !this.keepOpacity) {
this.clearOpacity()
Object.entries(opacity).forEach(([k, v]) => {
if (typeof v === 'undefined' || v === null || Number.isNaN(v)) return
if (v === undefined || v === null || Number.isNaN(v)) return
this[k + 'OpacityLocal'] = v
})
}

View file

@ -154,7 +154,7 @@ const Timeline = {
})
},
mounted() {
if (typeof document.hidden !== 'undefined') {
if (document.hidden !== undefined) {
document.addEventListener(
'visibilitychange',
this.handleVisibilityChange,
@ -168,7 +168,7 @@ const Timeline = {
unmounted() {
window.removeEventListener('scroll', this.handleScroll)
window.removeEventListener('keydown', this.handleShortKey)
if (typeof document.hidden !== 'undefined')
if (document.hidden !== undefined)
document.removeEventListener(
'visibilitychange',
this.handleVisibilityChange,

View file

@ -34,15 +34,15 @@ const VideoAttachment = {
// If hasAudio is false, we've already marked this video to not have audio,
// a video can't gain audio out of nowhere so don't bother checking again.
if (!this.hasAudio) return
if (typeof target.webkitAudioDecodedByteCount !== 'undefined') {
if (target.webkitAudioDecodedByteCount !== undefined) {
// non-zero if video has audio track
if (target.webkitAudioDecodedByteCount > 0) return
}
if (typeof target.mozHasAudio !== 'undefined') {
if (target.mozHasAudio !== undefined) {
// true if video has audio track
if (target.mozHasAudio) return
}
if (typeof target.audioTracks !== 'undefined') {
if (target.audioTracks !== undefined) {
if (target.audioTracks.length > 0) return
}
this.hasAudio = false

View file

@ -271,7 +271,7 @@ export const getTextColor = function (bg, text, preserve) {
contrast = getContrastRatio(bg, convert(result).rgb)
}
const base = typeof text.a !== 'undefined' ? { a: text.a } : {}
const base = text.a !== undefined ? { a: text.a } : {}
return Object.assign(convert(result).rgb, base)
}

View file

@ -177,7 +177,7 @@ export const parseUser = (data) => {
// deactivated was changed to is_active in Pleroma 2.3.0
// so check if is_active is present
output.deactivated =
typeof data.pleroma.is_active !== 'undefined'
data.pleroma.is_active !== undefined
? !data.pleroma.is_active // new backend
: data.pleroma.deactivated // old backend

View file

@ -523,7 +523,7 @@ export const generateColors = (themeData) => {
(acc, [k, v]) => {
if (!v) return acc
acc.solid[k] = rgb2hex(v)
acc.complete[k] = typeof v.a === 'undefined' ? rgb2hex(v) : rgba2css(v)
acc.complete[k] = v.a === undefined ? rgb2hex(v) : rgba2css(v)
return acc
},
{ complete: {}, solid: {} },
@ -545,7 +545,7 @@ export const generateColors = (themeData) => {
export const generateRadii = (input) => {
let inputRadii = input.radii || {}
// v1 -> v2
if (typeof input.btnRadius !== 'undefined') {
if (input.btnRadius !== undefined) {
inputRadii = Object.entries(input)
.filter(([k]) => k.endsWith('Radius'))
.reduce((acc, e) => {