@lightningkite/ktor-batteries
Version:
38 lines • 1.5 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.xListComparatorGet = exports.SortPart = void 0;
// Package: com.lightningkite.ktordb
// Generated by Khrysalis - this file will be overwritten.
const khrysalis_runtime_1 = require("@lightningkite/khrysalis-runtime");
//! Declares com.lightningkite.ktordb.SortPart
class SortPart {
constructor(field, ascending = true) {
this.field = field;
this.ascending = ascending;
}
static propertyTypes(T) { return { field: [String, T], ascending: [Boolean] }; }
static constructorKProperty1comSortPartTAnyBoolean(field, ascending = true) {
let result = new SortPart(field, ascending);
return result;
}
}
exports.SortPart = SortPart;
SortPart.properties = ["field", "ascending"];
(0, khrysalis_runtime_1.setUpDataClass)(SortPart);
//! Declares com.lightningkite.ktordb.comparator>kotlin.collections.Listcom.lightningkite.ktordb.SortPartcom.lightningkite.ktordb.comparator.T
function xListComparatorGet(this_) {
if (this_.length === 0) {
return null;
}
return (a, b) => {
for (const part of this_) {
const result = (0, khrysalis_runtime_1.compareBy)(part.field)(a, b);
if (!(result === 0)) {
return part.ascending ? result : (-result);
}
}
return 0;
};
}
exports.xListComparatorGet = xListComparatorGet;
//# sourceMappingURL=SortPart.js.map