Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function collect(records) {
if (!records || !records.length) {
return cb(new NotFoundError("Key not found in database [" + key + "]"))
}
var r = records[0]
// TODO other options?
if (options && options.valueEncoding == "json") r.value = JSON.parse(r.value)
return cb(null, r.value, r.version)
}