|
"use strict";
|
|
|
|
const sortCollectionBy = (collection, key) => {
|
|
collection.sort((a, b) => {
|
|
a = a[key].toLowerCase();
|
|
b = b[key].toLowerCase();
|
|
if (a < b) return -1;
|
|
if (a > b) return 1;
|
|
return 0;
|
|
});
|
|
return collection;
|
|
};
|
|
|
|
exports.sortCollection = sortCollectionBy;
|