Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

Commit 36cb067

Browse files
committed
Fix increment endpoints concatenating strings
1 parent 63f4c9b commit 36cb067

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/lib/orbitdb-api.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class OrbitdbAPI extends Express {
7777
var db_inc = asyncMiddleware( async (req, res, next) => {
7878
let db, hash
7979
db = await dbm.get(req.params.dbname)
80-
hash = await db.inc(req.body.val)
80+
hash = await db.inc(parseInt(req.body.val))
8181
return res.json(hash)
8282
});
8383

@@ -87,7 +87,7 @@ class OrbitdbAPI extends Express {
8787
var db_inc_val = asyncMiddleware( async (req, res, next) => {
8888
let db, hash
8989
db = await dbm.get(req.params.dbname)
90-
hash = await db.inc(req.params.val)
90+
hash = await db.inc(parseInt(req.params.val))
9191
return res.json(hash)
9292
});
9393

@@ -102,7 +102,7 @@ class OrbitdbAPI extends Express {
102102
'gte': (a, b) => a >= b,
103103
'lte': (a, b) => a <= b,
104104
'mod': (a, b, c) => a % b == c,
105-
'range': (a, b, c) => min(b,c) >= a && a <= max(b,c),
105+
'range': (a, b, c) => min(b,c) <= a && a >= max(b,c),
106106
'all': () => true
107107
};
108108

0 commit comments

Comments
 (0)