lib/core.js
function $var(params, fn, envs) {
    if (params == null) {
        return params;
    }
    if (typeof params === 'string') {
        if (envs && envs[params] !== undefined) {
            return envs[params];
        }

        return;
    }
    if (Array.isArray(params) && params.length === 2) {
        const key = params[0];
        if (typeof key === 'string') {
            const value = fn.$var(key, fn, envs);

            return value === undefined ? params[1] : value;
        }
    }
    throw new Error(
        '$var expects a string or an array with two elements of which the first one must be a string'
    );
}
function $var(params, fn, envs) {
    if (params == null) {
        return params;
    }
    if (typeof params === 'string') {
        if (envs && envs[params] !== undefined) {
            return envs[params];
        }

        return;
    }
    if (Array.isArray(params) && params.length === 2) {
        const key = params[0];
        if (typeof key === 'string') {
            const value = fn.$var(key, fn, envs);

            return value === undefined ? params[1] : value;
        }
    }
    throw new Error(
        '$var expects a string or an array with two elements of which the first one must be a string'
    );
}
function $var ( params , fn , envs ) { if ( params == null ) { return params ; } if ( typeof params === 'string' ) { if ( envs && envs [ params ] !== undefined ) { return envs [ params ] ; } return ; } if ( Array . isArray ( params ) && params . length === 2 ) { const key = params [ 0 ] ; if ( typeof key === 'string' ) { const value = fn . $var ( key , fn , envs ) ; return value === undefined ? params [ 1 ] : value ; } } throw new Error ( '$var expects a string or an array with two elements of which the first one must be a string' ) ; }
Get value from envs with an optional fallback value

@param {string|[string, any]} params
@returns {any}
Get value from envs with an optional fallback value