diff --git a/component.js b/component.js index 62e616d..e8e51d9 100644 --- a/component.js +++ b/component.js @@ -378,7 +378,7 @@ export const defineListComponent = createComponentDefiner(() => { component.removeChild(prevChild) } // insert remaining - component.insertBefore(dom.fragment(insert.slice(insertStart).map(insState => { + component.insertBefore(dom.fragment(insert.slice(insertStart).map(/** @param {any} insState */ insState => { const el = new Item() el.setState(insState) return el diff --git a/environment.js b/environment.js index 3127448..5ebf4c3 100644 --- a/environment.js +++ b/environment.js @@ -94,7 +94,7 @@ export const getParam = (name, defaultVal) => /* c8 ignore next 4 */ export const getVariable = (name) => isNode - ? conditions.undefinedToNull(process.env[name.toUpperCase()]) + ? conditions.undefinedToNull(process.env[name.toUpperCase().replaceAll('-', '_')]) : conditions.undefinedToNull(storage.varStorage.getItem(name)) /** @@ -105,6 +105,17 @@ export const getVariable = (name) => export const getConf = (name) => computeParams().get('--' + name) || getVariable(name) +/** + * @param {string} name + * @return {string} + */ +/* c8 ignore next 4 */ +export const ensureConf = (name) => { + const c = getConf(name) + if (c == null) throw new Error(`Expected configuration "${name.toUpperCase().replaceAll('-', '_')}"`) + return c +} + /** * @param {string} name * @return {boolean}