Create a helper function to sort two attributes
This commit is contained in:
parent
cade7f6ce5
commit
02a553e6c9
1 changed files with 6 additions and 0 deletions
6
module/utils/attributeSort.mjs
Normal file
6
module/utils/attributeSort.mjs
Normal file
|
|
@ -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);
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue