sortProperties
lib.modules.sortProperties
Docs pulled from | This Revision | 10 minutes ago
Sort a list of properties. The sort priority of a property is defaultOrderPriority by default, but can be overridden by wrapping the property using mkOrder.
Inputs
defs
-
1. Function argument
Noogle detected
Implementation
The following is the current implementation of this function.
sortProperties = defs:
let
strip = def:
if def.value._type or "" == "order"
then def // { value = def.value.content; inherit (def.value) priority; }
else def;
defs' = map strip defs;
compare = a: b: (a.priority or defaultOrderPriority) < (b.priority or defaultOrderPriority);
in sort compare defs';