All files / dist SortPart.js

42.1% Statements 8/19
0% Branches 0/7
0% Functions 0/4
42.1% Lines 8/19

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35  1x 1x     1x 1x                 1x 1x 1x                               1x  
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.xListComparatorGet = exports.SortPart = void 0;
// Package: com.lightningkite.lightningdb
// Generated by Khrysalis - this file will be overwritten.
const DataClassProperty_1 = require("./DataClassProperty");
const khrysalis_runtime_1 = require("@lightningkite/khrysalis-runtime");
//! Declares com.lightningkite.lightningdb.SortPart
class SortPart {
    constructor(field, ascending = true) {
        this.field = field;
        this.ascending = ascending;
    }
    static propertyTypes(T) { return { field: [DataClassProperty_1.PartialDataClassProperty, T], ascending: [Boolean] }; }
}
exports.SortPart = SortPart;
SortPart.properties = ["field", "ascending"];
(0, khrysalis_runtime_1.setUpDataClass)(SortPart);
//! Declares com.lightningkite.lightningdb.comparator>kotlin.collections.Listcom.lightningkite.lightningdb.SortPartcom.lightningkite.lightningdb.comparator.T
function xListComparatorGet(this_) {
    if (this_.length === 0) {
        return null;
    }
    return (a, b) => {
        for (const part of this_) {
            const result = part.field.compare(a, b);
            if (!(result === 0)) {
                return part.ascending ? result : (-result);
            }
        }
        return 0;
    };
}
exports.xListComparatorGet = xListComparatorGet;
//# sourceMappingURL=SortPart.js.map