Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function reviews() {
var app = APPS[currentIndex];
incrementIndex(APPS.length);
var request = gplay.reviews({
appId: app.package,
page: 0,
sort: gplay.sort.NEWEST
});
return request.then(toRuleResult(app));
}
const subpath = '/apps/' + req.params.appId + '/reviews/';
if (page > 0) {
req.query.page = page - 1;
apps.prev = buildUrl(req, subpath) + '?' + qs.stringify(req.query);
}
if (apps.results.length) {
req.query.page = page + 1;
apps.next = buildUrl(req, subpath) + '?' + qs.stringify(req.query);
}
return apps;
}
const opts = Object.assign({appId: req.params.appId}, req.query);
gplay.reviews(opts)
.then(toList)
.then(paginate)
.then(res.json.bind(res))
.catch(next);
});