{"size": 514, "ext": "js", "max_stars_repo_path": "web/g-waitgroup.js", "max_stars_repo_name": "gansoi/gansoi", "max_stars_repo_stars_event_min_datetime": "2016-12-28T09:00:16.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-10T12:21:50.000Z", "max_issues_repo_path": "web/g-waitgroup.js", "max_issues_repo_name": "gansoi/gansoi", "max_issues_repo_issues_event_min_datetime": "2017-02-07T11:17:26.000Z", "max_issues_repo_issues_event_max_datetime": "2019-05-21T20:50:59.000Z", "max_forks_repo_path": "web/g-waitgroup.js", "max_forks_repo_name": "gansoi/gansoi", "max_forks_repo_forks_event_min_datetime": "2017-09-10T16:57:01.000Z", "max_forks_repo_forks_event_max_datetime": "2020-11-27T18:06:47.000Z"}
{"max_stars_count": 30, "max_issues_count": 109, "max_forks_count": 7, "avg_line_length": 17.724137931, "max_line_length": 58, "alphanum_fraction": 0.486381323}
/**
 * Will wait for a number of done()'s before calling cb.
 * @param {!func} cb
 * @constructor
 */
g.waitGroup = function(cb) {
    var count = 0;

    /**
     * Add delta units of work to finish before calling cb
     * @param {!number} delta The number to add.
     */
    this.add = function(delta) {
        count += delta;
    };

    /**
     * Mark one job as done.
     */
    this.done = function() {
        count--;
        if (count === 0) {
            cb();
        }
    };

    return this;
};
