MCPcopy Create free account
hub / github.com/angular/components / sortCategorizedPropertyMembers

Function sortCategorizedPropertyMembers

tools/dgeni/common/sort-members.ts:30–62  ·  view source on GitHub ↗
(
  docA: CategorizedPropertyMemberDoc,
  docB: CategorizedPropertyMemberDoc,
)

Source from the content-addressed store, hash-verified

28
29/** Sorts property members by deprecated status, member decorator, and name. */
30export function sortCategorizedPropertyMembers(
31 docA: CategorizedPropertyMemberDoc,
32 docB: CategorizedPropertyMemberDoc,
33) {
34 // Sort deprecated docs to the end
35 if (!docA.isDeprecated && docB.isDeprecated) {
36 return -1;
37 }
38
39 if (docA.isDeprecated && !docB.isDeprecated) {
40 return 1;
41 }
42
43 // Sort in the order of: Inputs, Outputs, neither
44 if ((docA.isInput && !docB.isInput) || (docA.isOutput && !docB.isInput && !docB.isOutput)) {
45 return -1;
46 }
47
48 if ((docB.isInput && !docA.isInput) || (docB.isOutput && !docA.isInput && !docA.isOutput)) {
49 return 1;
50 }
51
52 // Break ties by sorting alphabetically on the name
53 if (docA.name < docB.name) {
54 return -1;
55 }
56
57 if (docA.name > docB.name) {
58 return 1;
59 }
60
61 return 0;
62}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected