MCPcopy Create free account
hub / github.com/Free-APIs/Free-APIs.github.io / output

Function output

src/components/ListDisplay/index.js:54–94  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

52 );
53
54 const output = () => {
55 if (props.isCategory) {
56 listItems.sort((a, b) =>
57 a['Category'].localeCompare(b['Category']),
58 );
59 }
60
61 let previous = null;
62
63 return (
64 <>
65 {display.map((api, index) => {
66 let current = api['Category'];
67 let card;
68
69 if (display.length === index + 1) {
70 card = (
71 <Card key={api['API']} passedRef={lastElementRef}>
72 {api}
73 </Card>
74 );
75 } else {
76 card = <Card key={api['API']}>{api}</Card>;
77 }
78
79 let val = (
80 <Fragment key={api['API']}>
81 {props.isCategory &&
82 previous !== current &&
83 header(current)}
84 {card}
85 </Fragment>
86 );
87
88 previous = current;
89
90 return val;
91 })}
92 </>
93 );
94 };
95
96 return (
97 <>

Callers

nothing calls this directly

Calls 1

headerFunction · 0.85

Tested by

no test coverage detected