From c2cd91efc2b30c0774db1088f94e511c63a443b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Meier?= Date: Sun, 29 Oct 2023 05:05:15 +0100 Subject: [PATCH] Publish v0.2.14 add dom/util.js fontSize --- src/dom/util.js | 8 +++++++- src/graphql/error.js | 4 +--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/dom/util.js b/src/dom/util.js index 63e968f..8c5912a 100644 --- a/src/dom/util.js +++ b/src/dom/util.js @@ -82,6 +82,12 @@ export function inViewY(el) { // name --my-var export function cssVar(name, el = null) { if (!el) - el = document.body; + el = document.documentElement; return getComputedStyle(el).getPropertyValue(name); +} + +export function fontSize(name, el = null) { + if (!el) + el = document.documentElement; + return parseFloat(getComputedStyle(el).fontSize); } \ No newline at end of file diff --git a/src/graphql/error.js b/src/graphql/error.js index 7d92f26..c223730 100644 --- a/src/graphql/error.js +++ b/src/graphql/error.js @@ -17,9 +17,7 @@ export default class GraphQlError { if (typeof errors === 'string') errors = [{ message: errors }]; - if (Array.isArray(errors)) - errors = errors; - else + else if (!Array.isArray(errors)) errors = [errors]; this.errors = errors;