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;