chore(doc-gen): speed up class member sorting
This commit is contained in:
parent
33f5aafd6c
commit
b9b58f7ed9
|
@ -34,9 +34,7 @@ module.exports = function readTypeScriptModules(tsParser, readFilesProcessor, mo
|
||||||
var ignoreExportsMatching = convertToRegexCollection(this.ignoreExportsMatching);
|
var ignoreExportsMatching = convertToRegexCollection(this.ignoreExportsMatching);
|
||||||
|
|
||||||
var hidePrivateMembers = this.hidePrivateMembers;
|
var hidePrivateMembers = this.hidePrivateMembers;
|
||||||
var addMember = this.sortClassMembers ? insertSorted : function(collection, item) {
|
var sortClassMembers = this.sortClassMembers;
|
||||||
collection.push(item);
|
|
||||||
};
|
|
||||||
|
|
||||||
var basePath = path.resolve(readFilesProcessor.basePath, this.basePath);
|
var basePath = path.resolve(readFilesProcessor.basePath, this.basePath);
|
||||||
var filesPaths = expandSourceFiles(this.sourceFiles, basePath);
|
var filesPaths = expandSourceFiles(this.sourceFiles, basePath);
|
||||||
|
@ -79,9 +77,17 @@ module.exports = function readTypeScriptModules(tsParser, readFilesProcessor, mo
|
||||||
docs.push(memberDoc);
|
docs.push(memberDoc);
|
||||||
} else if (!hidePrivateMembers || memberSymbol.name.charAt(0) !== '_') {
|
} else if (!hidePrivateMembers || memberSymbol.name.charAt(0) !== '_') {
|
||||||
docs.push(memberDoc);
|
docs.push(memberDoc);
|
||||||
addMember(exportDoc.members, memberDoc, 'name');
|
exportDoc.members.push(memberDoc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sortClassMembers) {
|
||||||
|
exportDoc.members.sort(function(a, b) {
|
||||||
|
if (a.name > b.name) return 1;
|
||||||
|
if (a.name < b.name) return -1;
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add this export doc to its module doc
|
// Add this export doc to its module doc
|
||||||
|
|
Loading…
Reference in New Issue