Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
throw new Error('reduce not supported');
}
function ddocValidator(ddoc, viewName) {
var view = ddoc.views[viewName];
// This doesn't actually need to be here apparently, but
// I feel safer keeping it.
/* istanbul ignore if */
if (!view.map || !view.map.fields) {
throw new Error('ddoc ' + ddoc._id +' with view ' + viewName +
' doesn\'t have map.fields defined. ' +
'maybe it wasn\'t created by this plugin?');
}
}
var abstractMapper = abstractMapReduce(
/* localDocName */ 'indexes',
mapper,
reducer,
ddocValidator
);
export default function (db) {
return db._customFindAbstractMapper || abstractMapper;
}
return builtIn;
} else {
return evalFunction(reduceFunString);
}
}
function ddocValidator(ddoc, viewName) {
var fun = ddoc.views && ddoc.views[viewName];
if (typeof fun.map !== 'string') {
throw new NotFoundError('ddoc ' + ddoc._id + ' has no string view named ' +
viewName + ', instead found object of type: ' + typeof fun.map);
}
}
var localDocName = 'mrviews';
var abstract = createAbstractMapReduce(localDocName, mapper, reducer, ddocValidator);
function query(fun, opts, callback) {
return abstract.query.call(this, fun, opts, callback);
}
function viewCleanup(callback) {
return abstract.viewCleanup.call(this, callback);
}
export default {
query: query,
viewCleanup: viewCleanup
};