lib/npm-package-env.js
function init(obj = {}, prevName = '') {
    return new Proxy(obj, {
        get (target, name) {
            if (typeof name === 'symbol' || deflectedProperties.includes(name)) {
                return Reflect.get(target, name);
            }
            ns.resetTo(prevName);
            ns.push(name);
            let value = process.env[ns.serialize()];
            if (value) {
                ns.pop();
                return value;
            }
            return init(target, name);
        },
        set (target, name, val) {
            ns.resetTo(prevName);
            ns.push(name);
            let value = String(val);
            process.env[ns.serialize()] = value;
            ns.pop();
            return value;
        }
    });
}
function init(obj = {}, prevName = '') {
    return new Proxy(obj, {
        get (target, name) {
            if (typeof name === 'symbol' || deflectedProperties.includes(name)) {
                return Reflect.get(target, name);
            }
            ns.resetTo(prevName);
            ns.push(name);
            let value = process.env[ns.serialize()];
            if (value) {
                ns.pop();
                return value;
            }
            return init(target, name);
        },
        set (target, name, val) {
            ns.resetTo(prevName);
            ns.push(name);
            let value = String(val);
            process.env[ns.serialize()] = value;
            ns.pop();
            return value;
        }
    });
}
function init ( obj = { } , prevName = '' ) { return new Proxy ( obj , { get ( target , name ) { if ( typeof name === 'symbol' || deflectedProperties . includes ( name ) ) { return Reflect . get ( target , name ) ; } ns . resetTo ( prevName ) ; ns . push ( name ) ; let value = process . env [ ns . serialize ( ) ] ; if ( value ) { ns . pop ( ) ; return value ; } return init ( target , name ) ; } , set ( target , name , val ) { ns . resetTo ( prevName ) ; ns . push ( name ) ; let value = String ( val ) ; process . env [ ns . serialize ( ) ] = value ; ns . pop ( ) ; return value ; } } ) ; }
empty prevName indicates the first access in the chain
empty prevName indicates the first access in the chain