From 8890250fcb2e245cd440626997cb5f5fb6608eb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Meier?= Date: Sun, 29 Oct 2023 05:05:38 +0100 Subject: [PATCH] Publish v0.2.14 add dom/util.js fontSize --- package.json | 2 +- src/dom/util.js | 8 +++++++- src/graphql/error.js | 4 +--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index f3903e3..980eb61 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fire-lib-js", - "version": "0.2.13", + "version": "0.2.14", "author": "Sören Meier ", "type": "module", "scripts": { 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;