{"size": 1044, "ext": "js", "max_stars_repo_path": "src/igz_controls/services/common-table.service.js", "max_stars_repo_name": "mavdryk/dashboard-controls", "max_stars_repo_stars_event_min_datetime": "2020-03-24T12:20:39.000Z", "max_stars_repo_stars_event_max_datetime": "2020-03-24T12:20:39.000Z", "max_issues_repo_path": "src/igz_controls/services/common-table.service.js", "max_issues_repo_name": "mavdryk/dashboard-controls", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/igz_controls/services/common-table.service.js", "max_forks_repo_name": "mavdryk/dashboard-controls", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 29.0, "max_line_length": 114, "alphanum_fraction": 0.5411877395}
(function () {
    'use strict';

    angular.module('iguazio.dashboard-controls')
        .factory('CommonTableService', CommonTableService);

    function CommonTableService() {
        return {
            isColumnSorted: isColumnSorted
        };

        //
        // Public methods
        //

        /**
         * Checks whether the passed column name equals the last sorted column name
         * @param {string} columnName
         * @param {string} lastSortedColumnName
         * @param {boolean} isReversed
         * @return {{sorted: boolean, reversed: boolean}} - an object with css class names suitable for `ng-class`
         */
        function isColumnSorted(columnName, lastSortedColumnName, isReversed) {
            var classes = {
                'sorted': false,
                'reversed': false
            };
            if (columnName === lastSortedColumnName) {
                classes.sorted = true;
                classes.reversed = isReversed;
            }
            return classes;
        }
    }
}());
