{"size": 1499, "ext": "js", "max_stars_repo_path": "source/proxyTest.js", "max_stars_repo_name": "Tcdian/finally", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "source/proxyTest.js", "max_issues_repo_name": "Tcdian/finally", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "source/proxyTest.js", "max_forks_repo_name": "Tcdian/finally", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 21.1126760563, "max_line_length": 69, "alphanum_fraction": 0.4589726484}
const proxy = new Proxy(
    {},
    {
        get: function(target, prperty) {
            return 100;
        }
    }
);

// console.log(proxy.time, 10);
// console.log(proxy.name, 11);

const proxy1 = Object.create(proxy);

// console.log(proxy1.name, 15);

const handler = {
    get: function(target, name) {
        if (name === 'prototype') {
            return Object.prototype;
        }
        return 'Hello,' + name;
    },

    apply: function(target, thisArg, args) {
        console.log(target, thisArg, args);
        return 1;
    }
};

function add(a, b) {
    return a + b;
}

const addProxy = new Proxy(add, handler);

// console.log(add(1, 2), 37);
// console.log(addProxy(1, 2), 38);

const pipe = (function() {
    return function(value) {
        const funcStack = [];
        const oprxy = new Proxy(
            {},
            {
                get: function(pipeObject, fnName) {
                    if (fnName === 'get') {
                        return funcStack.reduce((val, currenVal) => {
                            return currenVal(val);
                        }, value);
                    }
                    funcStack.push(window[fnName]);
                    return oprxy;
                }
            }
        );
        return oprxy;
    };
})();

var double = n => n * 2;
var pow = n => n * n;
var reverseInt = n =>
    n
        .toString()
        .split('')
        .reverse()
        .join('-');

// console.log(pipe(3).double.pow.reverseInt.get);
