File tree Expand file tree Collapse file tree 1 file changed +0
-23
lines changed
src/adapter/search-response-adapter Expand file tree Collapse file tree 1 file changed +0
-23
lines changed Original file line number Diff line number Diff line change 11import type { MeiliSearchResponse , PaginationContext } from '../../types'
22import { ceiledDivision } from '../../utils'
33
4- /**
5- * Slice the requested hits based on the pagination position.
6- *
7- * @param {Record<string } hits
8- * @param {number } page
9- * @param {number } hitsPerPage
10- * @returns {Array }
11- */
12- export function adaptPagination (
13- hits : Record < string , any > ,
14- page : number ,
15- hitsPerPage : number
16- ) : Array < Record < string , any > > {
17- if ( hitsPerPage < 0 ) {
18- throw new TypeError (
19- 'Value too small for "hitsPerPage" parameter, expected integer between 0 and 9223372036854775807'
20- )
21- }
22- const start = page * hitsPerPage
23- return hits . slice ( start , start + hitsPerPage )
24- }
25-
26- // export function adaptNbPages(): number {}
274function adaptHitsPerPage (
285 searchResponse : MeiliSearchResponse < Record < string , any > > ,
296 paginationContext : PaginationContext
You can’t perform that action at this time.
0 commit comments