Skip to content

Commit 8b98685

Browse files
committed
Sorting checked domains by name.
1 parent 11c86c3 commit 8b98685

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

lib/commands/domain/domain._js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,17 @@ exports.init = function (cli) {
4444

4545
var domainClient = new DomainClient(cli);
4646

47+
function sortByName(a, b) {
48+
var nameA=a.name.toLowerCase(), nameB=b.name.toLowerCase();
49+
if (nameA < nameB) { //sort string ascending
50+
return -1;
51+
}
52+
if (nameA > nameB) {
53+
return 1;
54+
}
55+
return 0; //default return value (no sorting)
56+
}
57+
4758
domain.listCommand = function (name, options, _) {
4859
var context = {
4960
subscription: profile.current.getSubscription(options.subscription).id,
@@ -256,6 +267,7 @@ exports.init = function (cli) {
256267
}
257268
}, _);
258269
}, _);
270+
results = results.sort(sortByName);
259271
//results = async.parallel(checks, _);
260272
} else {
261273
results = [domain.doDomainCheck(context, _)];

0 commit comments

Comments
 (0)