{"size": 1249, "ext": "js", "max_stars_repo_path": "VwM/wwwroot/js/datatables/plugins/sort-versions.js", "max_stars_repo_name": "gh0stwizard/VwM", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "VwM/wwwroot/js/datatables/plugins/sort-versions.js", "max_issues_repo_name": "gh0stwizard/VwM", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "VwM/wwwroot/js/datatables/plugins/sort-versions.js", "max_forks_repo_name": "gh0stwizard/VwM", "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": 24.0192307692, "max_line_length": 72, "alphanum_fraction": 0.45316253}
﻿(function() {
    /*
     * Taken from https://stackoverflow.com/questions/7717109
     * Author: Gras Double
     */

    function padParts(version) {
        return version
            .split('.')
            .map(function (part) {
                var int = parseInt(part);

                if (!isNaN(int) && isFinite(int))
                    return '00000000'.substr(0, 8 - part.length) + part;
                else
                    return part;
            })
            .join('.');
    }

    function cmpVersions(a, b) {
        a = padParts(a);
        b = padParts(b);

        return a.localeCompare(b);
    }

    jQuery.extend(jQuery.fn.dataTableExt.oSort, {
        "version-asc": function (a, b) {
            return cmpVersions(a, b);
        },

        "version-desc": function (a, b) {
            return cmpVersions(a, b) * -1;
        },

        "version-ci-asc": function (a, b) {
            a = a.toString().toLowerCase();
            b = b.toString().toLowerCase();

            return cmpVersions(a, b);
        },

        "version-ci-desc": function (a, b) {
            a = a.toString().toLowerCase();
            b = b.toString().toLowerCase();

            return cmpVersions(a, b) * -1;
        }
    });
}());
