paginate

Use bufferCount to break a stream of data into pages of certain size. Paginate will keep track of the number of pages, the begin and end index count of the items in the page. Source data passed to paginate needs to be an array.

Output data will have the following schema


{
    page: number,       // Page count
    begin: number,      // Begin index count
    end: number,        // End index count
    items: any[]        // Source data
    hasNext: boolean    // Has next page?
}
paginate()

Examples