const sortByProperty = (array, propertyName) => {
return array.sort(function (a, b) {
if (a[propertyName] < b[propertyName]) {
return - 1
} else if (a[propertyName] > b[propertyName]) {
return 1
}
return 0
});
}