Total Complexity | 3 |
Complexity/F | 3 |
Lines of Code | 23 |
Function Count | 1 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | 'use strict' |
||
2 | |||
3 | import Table from 'cli-table' |
||
4 | import assert from 'assert-plus' |
||
5 | |||
6 | function listAll (server) { |
||
7 | assert.object(server) |
||
8 | |||
9 | const routes = server.router.getRoutes() |
||
10 | const table = new Table({ head: ['', 'name', 'path'] }) |
||
11 | |||
12 | for (let key in routes) { |
||
13 | if (routes.hasOwnProperty(key)) { |
||
14 | const val = routes[key] |
||
15 | const _o = {} |
||
16 | _o[val.method] = [val.name, val.path] |
||
17 | table.push(_o) |
||
18 | } |
||
19 | } |
||
20 | return table.toString() |
||
21 | } |
||
22 | |||
23 | module.exports = listAll |
||
24 |