{"size": 745, "ext": "js", "max_stars_repo_path": "src/classlist.js", "max_stars_repo_name": "binsenpai/anything.js", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/classlist.js", "max_issues_repo_name": "binsenpai/anything.js", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/classlist.js", "max_forks_repo_name": "binsenpai/anything.js", "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": 29.8, "max_line_length": 127, "alphanum_fraction": 0.5395973154}
var classlist = function (el) {
    this.addClass = function(className) {
        if (el.classList)
            el.classList.add(className);
        else
            el.className += ' ' + className;
    };

    this.removeClass = function(className) {
        if (el.classList)
            el.classList.remove(className);
        else
            el.className = el.className.replace(new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi'), ' ');
    };

    this.hasClass = function(className) {
        if (el.classList)
            return el.classList.contains(className);
        else
            return new RegExp('(^| )' + className + '( |$)', 'gi').test(el.className);
    };
};

anything.prototype.classlist = classlist;
