MCPcopy Create free account
hub / github.com/BrasilAPI/BrasilAPI / paginate

Function paginate

pages/api/tuss/v1/index.js:18–28  ·  view source on GitHub ↗
(items, limitNum, offsetNum)

Source from the content-addressed store, hash-verified

16}
17
18function paginate(items, limitNum, offsetNum) {
19 if (typeof limitNum === 'number') {
20 const start = offsetNum;
21 const end = offsetNum + limitNum;
22 return items.slice(start, end);
23 }
24 if (offsetNum > 0) {
25 return items.slice(offsetNum);
26 }
27 return items;
28}
29
30async function TussSearch(request, response) {
31 const { name, tuss, limit, offset } = request.query;

Callers 1

TussSearchFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected