1 Answer
- Newest
- Most votes
- Most comments
0
Hi, I would suggest to try this out:
- try, just for experiment, to not use "=>" arrow function but rather a function
const compareFn = function(a, b) {
return (a.event_ts - b.event_ts)
if ( a.event_ts < b.event_ts ){
return -1;
}
if ( a.event_ts > b.event_ts ){
return 1;
}
return 0;
};
- Alternatively use the "map" function on the array before you call the sort method. (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map)
Relevant content
- Accepted Answerasked 7 months ago
- asked a year ago
- asked a year ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
Thanks for your attention @alatech. However, AppSync doesn't support functions as arguments, and when I try your suggestion I get the following error:
The might be a bug in the implementation of AppSync or any other limitation that I need to walk around.