Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function tryFilter(filter, doc, req) {
try {
return !filter(doc, req);
} catch (err) {
var msg = 'Filter function threw: ' + err.toString();
return pouchdbErrors.createError(pouchdbErrors.BAD_REQUEST, msg);
}
}
'use strict';
var replicate = require('./replicate');
var Replication = require('./replication');
var clone = require('pouchdb-utils').clone;
var errors = require('pouchdb-errors');
var createError = errors.createError;
var BAD_REQUEST = errors.BAD_REQUEST;
function toPouch(db, opts) {
var PouchConstructor = opts.PouchConstructor;
if (typeof db === 'string') {
return new PouchConstructor(db, opts);
} else {
return db;
}
}
function replicateWrapper(src, target, opts, callback) {
if (typeof opts === 'function') {
callback = opts;
opts = {};
}