({ list, perPage = defaultPerPage })
| 3 | |
| 4 | export class PaginatedList { |
| 5 | constructor({ list, perPage = defaultPerPage }) { |
| 6 | |
| 7 | // Catch errors if the list is not an array or a function |
| 8 | if ( !Array.isArray( list ) && typeof list !== 'function' ) { |
| 9 | throw new Error(`List must be an array or a function but is ${typeof list}`) |
| 10 | } |
| 11 | |
| 12 | this.listArg = list |
| 13 | this.perPage = perPage |
| 14 | } |
| 15 | |
| 16 | get list () { |
| 17 | // if our list is a function, call it |
nothing calls this directly
no outgoing calls
no test coverage detected