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

@ -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) => {