var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __spreadArrays = (this && this.__spreadArrays) || function () {
    for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
    for (var r = Array(s), k = 0, i = 0; i < il; i++)
        for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
            r[k] = a[j];
    return r;
};
import { Pipe } from '@angular/core';
var SortCaseTypesPipe = /** @class */ (function () {
    function SortCaseTypesPipe() {
    }
    SortCaseTypesPipe.prototype.transform = function (caseTypes) {
        if (!caseTypes) {
            return [];
        }
        return __spreadArrays(caseTypes).sort(this.compareName);
    };
    SortCaseTypesPipe.prototype.compareName = function (a, b) {
        var nameA = a.name.toUpperCase();
        var nameB = b.name.toUpperCase();
        if (nameA < nameB) {
            return -1;
        }
        else if (nameA > nameB) {
            return 1;
        }
        // Equal
        return 0;
    };
    SortCaseTypesPipe = __decorate([
        Pipe({
            name: 'sortCaseTypes'
        })
    ], SortCaseTypesPipe);
    return SortCaseTypesPipe;
}());
export { SortCaseTypesPipe };
//# sourceMappingURL=sort-case-types.pipe.js.map