{"size": 641, "ext": "js", "max_stars_repo_path": "src/check.js", "max_stars_repo_name": "fleidloff/shapeCube", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/check.js", "max_issues_repo_name": "fleidloff/shapeCube", "max_issues_repo_issues_event_min_datetime": "2015-12-10T23:56:50.000Z", "max_issues_repo_issues_event_max_datetime": "2015-12-18T09:37:39.000Z", "max_forks_repo_path": "src/check.js", "max_forks_repo_name": "fleidloff/shapeCube", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 5, "max_forks_count": null, "avg_line_length": 27.8695652174, "max_line_length": 73, "alphanum_fraction": 0.4695787832}
import {types} from "./types";
import {options} from "./options";

function check(...params) {
    params.forEach(param => {
        for (let key in param) {
            if (typeof types[key] !== "function") {
                if (key !== "message") {
                    throw new Error(`type ${key} is not defined`)
                }
                return;
            }
            const defaultMessage = types[key](param[key]);
            if (defaultMessage !== true) {
                const e = new TypeError(param.message || defaultMessage);
                options.errorHandler(e);
            }
        };
    });
}

export {check}
