From 02a553e6c95900db9949add9b4de7bf0ff6d2710 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sun, 13 Jul 2025 21:49:40 -0600 Subject: [PATCH] Create a helper function to sort two attributes --- module/utils/attributeSort.mjs | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 module/utils/attributeSort.mjs diff --git a/module/utils/attributeSort.mjs b/module/utils/attributeSort.mjs new file mode 100644 index 0000000..7e114d3 --- /dev/null +++ b/module/utils/attributeSort.mjs @@ -0,0 +1,6 @@ +export function attributeSorter(a, b) { + if (a.sort === b.sort) { + return a.name.localeCompare(b.name); + }; + return Math.sign(a.sort - b.sort); +};