@abejarano/ts-mongodb-criteria 1.8.5 → 1.8.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,10 +7,11 @@ class Criteria {
7
7
  this.order = order;
8
8
  this.limit = limit;
9
9
  this.currentPage = offset;
10
- this.offset =
11
- offset !== undefined && limit !== undefined
12
- ? (offset - 1) * limit
13
- : undefined;
10
+ if (offset && limit) {
11
+ this.offset = offset > 0 ? (offset - 1) * limit : 0;
12
+ }
13
+ else
14
+ this.offset = undefined;
14
15
  }
15
16
  hasFilters() {
16
17
  return this.filters.filters.length > 0;
@@ -4,10 +4,11 @@ export class Criteria {
4
4
  this.order = order;
5
5
  this.limit = limit;
6
6
  this.currentPage = offset;
7
- this.offset =
8
- offset !== undefined && limit !== undefined
9
- ? (offset - 1) * limit
10
- : undefined;
7
+ if (offset && limit) {
8
+ this.offset = offset > 0 ? (offset - 1) * limit : 0;
9
+ }
10
+ else
11
+ this.offset = undefined;
11
12
  }
12
13
  hasFilters() {
13
14
  return this.filters.filters.length > 0;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@abejarano/ts-mongodb-criteria",
3
3
  "author": "angel bejarano / angel.bejarano@jaspesoft.com",
4
- "version": "1.8.5",
4
+ "version": "1.8.6",
5
5
  "description": "Patrón Criteria para consultas MongoDB en TypeScript",
6
6
  "main": "dist/cjs/index.js",
7
7
  "module": "dist/esm/index.js",