{"size": 740, "ext": "js", "max_stars_repo_path": "src/providers/DispatchingProvider.js", "max_stars_repo_name": "soldag/j29n", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/providers/DispatchingProvider.js", "max_issues_repo_name": "soldag/j29n", "max_issues_repo_issues_event_min_datetime": "2016-03-04T12:59:26.000Z", "max_issues_repo_issues_event_max_datetime": "2016-03-04T12:59:26.000Z", "max_forks_repo_path": "src/providers/DispatchingProvider.js", "max_forks_repo_name": "soldag/gettext.js", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 1, "max_forks_count": null, "avg_line_length": 26.4285714286, "max_line_length": 89, "alphanum_fraction": 0.6675675676}
function DispatchingProvider(providers) {
    this.providers = providers;
}


DispatchingProvider.prototype.canLoadFromOptions = function(options) {
    for(var i = 0; i < this.providers.length; i++) {
        if(this.providers[i].canLoadFromOptions(options)) {
            return true;
        }
    }

    return false;
};


DispatchingProvider.prototype.loadFromOptions = function(options, callback) {
    for(var i = 0; i < this.providers.length; i++) {
        if(this.providers[i].canLoadFromOptions(options)) {
            return this.providers[i].loadFromOptions(options, callback);
        }
    }

    throw new Error('There is no provider registered, that can load the given options.');
};


module.exports = DispatchingProvider;