Closed Sykander closed 4 years ago
function asyncMap(async function mappingFunction, [async function comparisonFunction=compareByUnicode]) {
// ...
}
function asyncMapIterable(Object iterable, async function mappingFunction, [async function comparisonFunction=compareByUnicode]) {
// ...
};
Inspiration https://github.com/Pimm/mapsort
This is because async functions will normally be calls to an external api and so mapSort is highly preferable over just sort when the compare function is asynchronous.
Implementation of this function is
mapSort( async (element, index, array) => { // return item ideal for sorting here }, async (a, b) => { // return comparison between items here after performing ideal sort map } )