File tree Expand file tree Collapse file tree 2 files changed +5
-6
lines changed Expand file tree Collapse file tree 2 files changed +5
-6
lines changed Original file line number Diff line number Diff line change 11function pagination ( query , options ) {
22 const result = { }
3-
43 result . limit = options . default . pagination . limit
54
65 if ( query . limit ) {
7- result . limit = processQuery ( query . limit )
6+ result . limit = processQuery ( query . limit ) || options . default . pagination . limit
87 }
98
109 if ( options . use_page ) {
1110 result . page = options . default . pagination . page
1211 if ( query . page ) {
13- result . page = processQuery ( query . page )
12+ result . page = processQuery ( query . page ) || options . default . pagination . page
1413 }
1514 } else {
1615 result . skip = options . default . pagination . skip
1716 if ( query . skip ) {
18- result . skip = processQuery ( query . skip )
17+ result . skip = processQuery ( query . skip ) || options . default . pagination . skip
1918 }
2019 }
2120
Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ describe('queryFilter()', function () {
8383 } )
8484 } )
8585
86- context ( 'when use pagination with page and query page is not a number' , function ( ) {
86+ context ( 'when use pagination with page and query page and limit is not a number' , function ( ) {
8787 it ( 'should return pagination param with default limit' , function ( ) {
8888
8989 const expect_pagination = {
@@ -94,7 +94,7 @@ describe('queryFilter()', function () {
9494 const options = JSON . parse ( JSON . stringify ( custom_options ) )
9595 options . default . pagination = expect_pagination
9696
97- const query = '?limit=teen'
97+ const query = '?page=current& limit=teen'
9898
9999 return request ( app )
100100 . get ( query )
You can’t perform that action at this time.
0 commit comments