Skip to content

Commit

Permalink
Merge pull request #8 from frenchrabbit/dev
Browse files Browse the repository at this point in the history
fix: fix paging when using skip.
  • Loading branch information
maddocnc committed Oct 24, 2023
2 parents ba071dc + b6dc194 commit 09eb963
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function paginateWithDefaults<T>(options?: PaginationOptions<T> | null) {

if (options?.skip) {
skip = options.skip
page = (skip / limit) + 1
page = Math.floor((skip / limit) + 1)
} else if (options?.page) {
page = options?.page
skip = (page - 1) * limit
Expand Down

0 comments on commit 09eb963

Please sign in to comment.