async-merge-sort
async-merge-sort
can efficiently sort an array with an asynchronous comparison function. It is suitable for sorts driven by prompting the user for each comparison, or any other situation where you cannot reduce each item to a "score" that can be compared synchronously.
How to use
// in-browser example, with browserify and jQuery. // Can also be used server side via npm install var asyncMergeSort = ; var $a = ; var $b = ; return ;
Limitations
Since the overwhelming majority of the time presumably is spent waiting around for the comparison function to invoke its callback, this module is not written with raw speed in mind. It's also possible to create fewer arrays. This was simply the most readable version of the algorithm.
Browser Compatibility
No new-wave JavaScript features are required. Expected to work in all browsers going back quite a long way.
Changelog
0.1.2: tests don't require lodash either. No other changes.
0.1.1: removed dependency on lodash. No longer imports any other modules.
0.1.0: initial version. Passing unit tests.
About P'unk Avenue and Apostrophe
async-merge-sort
was created at P'unk Avenue for use in projects based on Apostrophe, an open-source content management system built on node.js. If you like async-merge-sort
you should definitely check out apostrophenow.org. Also be sure to visit us on github.
Support
Feel free to open issues on github.