(filePath, maxLines)
| 34 | } |
| 35 | |
| 36 | function tailText(filePath, maxLines) { |
| 37 | try { |
| 38 | if (!filePath || !fs.existsSync(filePath)) return ''; |
| 39 | const raw = fs.readFileSync(filePath, 'utf8'); |
| 40 | const lines = raw.split('\n'); |
| 41 | return lines.slice(-toPositiveInt(maxLines, 200)).join('\n'); |
| 42 | } catch { |
| 43 | return ''; |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | function paginate(items, query = {}) { |
| 48 | const limit = Math.min(toPositiveInt(query.limit, 50), 200); |
no test coverage detected