From da65cbbc34d5c8421000da067001eca9118e237d Mon Sep 17 00:00:00 2001 From: Sean Lynch Date: Thu, 15 Oct 2015 22:18:29 -0400 Subject: [PATCH] Allow sending 'offset' and 'limit' params as strings. Fixes #22 --- src/index.js | 4 ++-- test/findAll.spec.js | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/index.js b/src/index.js index e597e98..2460280 100644 --- a/src/index.js +++ b/src/index.js @@ -142,11 +142,11 @@ function filterQuery (resourceConfig, params) { } if (params.skip) { - query = query.offset(params.offset) + query = query.offset(+params.offset) } if (params.limit) { - query = query.limit(params.limit) + query = query.limit(+params.limit) } return query diff --git a/test/findAll.spec.js b/test/findAll.spec.js index d193415..4cbcfa7 100644 --- a/test/findAll.spec.js +++ b/test/findAll.spec.js @@ -168,6 +168,8 @@ describe('DSSqlAdapter#findAll', function () { assert.equal(comments[0].content, 'test1'); }); - + it('should allow passing limit and offset as strings', function* () { + var user = yield adapter.findAll(User, {limit: '10', offset: '20'}); + }); });