Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var promiseForView = sourceDB.info().then(function (info) {
var depDbName = info.db_name + '-mrview-' +
(temporary ? 'temp' : stringMd5(viewSignature));
// save the view name in the source db so it can be cleaned up if necessary
// (e.g. when the _design doc is deleted, remove all associated view data)
function diffFunction(doc) {
doc.views = doc.views || {};
var fullViewName = viewName;
if (fullViewName.indexOf('/') === -1) {
fullViewName = viewName + '/' + viewName;
}
var depDbs = doc.views[fullViewName] = doc.views[fullViewName] || {};
/* istanbul ignore if */
if (depDbs[depDbName]) {
return; // no update necessary
}
depDbs[depDbName] = true;
return doc;
function getMd5() {
return md5 || (md5 = stringMd5(JSON.stringify(requestDef)));
}
function rev(doc, deterministic_revs) {
var clonedDoc = clone(doc);
if (!deterministic_revs) {
return uuid.v4().replace(/-/g, '').toLowerCase();
}
delete clonedDoc._rev_tree;
return stringMd5(JSON.stringify(clonedDoc));
}