« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/things/sorting-rule.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/data/things/sorting-rule.js')
-rw-r--r--src/data/things/sorting-rule.js8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/data/things/sorting-rule.js b/src/data/things/sorting-rule.js
index 808a0085..8ed3861a 100644
--- a/src/data/things/sorting-rule.js
+++ b/src/data/things/sorting-rule.js
@@ -146,7 +146,7 @@ export class ThingSortingRule extends SortingRule {
 
   sort(sortable) {
     if (this.properties) {
-      for (const property of this.properties.slice().reverse()) {
+      for (const property of this.properties.toReversed()) {
         const get = thing => thing[property];
         const lc = property.toLowerCase();
 
@@ -286,10 +286,8 @@ export class DocumentSortingRule extends ThingSortingRule {
   }
 
   static async* applyAll(rules, {wikiData, dataPath, dry}) {
-    rules =
-      rules
-        .slice()
-        .sort((a, b) => a.filename.localeCompare(b.filename, 'en'));
+    rules = rules
+      .toSorted((a, b) => a.filename.localeCompare(b.filename, 'en'));
 
     for (const {chunk, filename} of chunkByProperties(rules, ['filename'])) {
       const initialLayout = getThingLayoutForFilename(filename, wikiData);