(items, limitNum, offsetNum)
| 16 | } |
| 17 | |
| 18 | function 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 | |
| 30 | async function TussSearch(request, response) { |
| 31 | const { name, tuss, limit, offset } = request.query; |