{"size": 459, "ext": "js", "max_stars_repo_path": "examples/combinator_basics_2.js", "max_stars_repo_name": "kevinb7/es6-playground", "max_stars_repo_stars_event_min_datetime": "2015-01-21T15:58:19.000Z", "max_stars_repo_stars_event_max_datetime": "2015-01-21T15:58:19.000Z", "max_issues_repo_path": "examples/combinator_basics_2.js", "max_issues_repo_name": "kevinb7/es6-playground", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "examples/combinator_basics_2.js", "max_forks_repo_name": "kevinb7/es6-playground", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 19.9565217391, "max_line_length": 55, "alphanum_fraction": 0.559912854}
// combinator basics 2

var profile = function(name, fn, ...args) {
    var start = performance.now();
    var result = fn(...args);
    var elapsed = performance.now() - start;
    console.log(`${name}(${args}) took ${elapsed} ms`);

    return result;
};

var fact = function(x) {
    return x !== 0 ? fact(x - 1) * x : 1;
};

console.log(`100! = ${profile("fact", fact, 100)}`);

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

profile("add", add, 5, 10);
