Skip to content

Commit 3897fdf

Browse files
authored
Merge pull request #60 from Sykander/async-sort
Async Sort
2 parents bd38cea + 0bb357c commit 3897fdf

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ Sort an iterable object asynchronously
7171
async function asyncSort(callback) {...}
7272
```
7373

74-
7574
## Development
7675

7776
Development is open to contribution, check the project board "Development" for tickets.

src/async-sort.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ const { noParam } = require('./constants'),
1111
* @async
1212
* @param {Function} [compareFunc] - default is sort by item's unicode value
1313
* @return {Object}
14+
* @throws {TypeError}
1415
*/
1516
module.exports = async function asyncSort(compareFunc = noParam) {
16-
validateIsIterable(this);
17-
1817
const compare = compareFunc !== noParam ? compareFunc : compareByUnicode;
1918

2019
validateIsFunction(compare);
20+
validateIsIterable(this);
2121

2222
await asyncQuickSort(this, 0, this.length - 1, compare);
2323

src/helpers.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,14 @@ const swapItems = (module.exports.swapItems = function swapItems(
5555
});
5656

5757
/**
58-
* perform
58+
* Async partition an array for quick sort
5959
* @async
6060
* @param {Object} items
6161
* @param {Number} leftIndex
6262
* @param {Number} rightIndex
6363
* @param {Function} compare
6464
*/
65-
module.exports.asyncPartition = async function partition(
65+
module.exports.asyncPartition = async function asyncPartition(
6666
items,
6767
leftIndex,
6868
rightIndex,

0 commit comments

Comments
 (0)