Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var leveldown = opts.db;
var dbStore;
var leveldownName = functionName(leveldown);
if (dbStores.has(leveldownName)) {
dbStore = dbStores.get(leveldownName);
} else {
dbStore = new Map();
dbStores.set(leveldownName, dbStore);
}
if (dbStore.has(name)) {
db = dbStore.get(name);
afterDBCreated();
} else {
dbStore.set(name, sublevel(levelup(name, opts, function (err) {
/* istanbul ignore if */
if (err) {
dbStore.delete(name);
return callback(err);
}
db = dbStore.get(name);
db._docCount = -1;
db._queue = new Deque();
/* istanbul ignore else */
if (opts.migrate) { // migration for leveldown
migrate.toSublevel(name, db, afterDBCreated);
} else {
afterDBCreated();
}
})));
}
var leveldown = opts.db
var dbStore
var leveldownName = functionName(leveldown)
if (dbStores.has(leveldownName)) {
dbStore = dbStores.get(leveldownName)
} else {
dbStore = new Map()
dbStores.set(leveldownName, dbStore)
}
if (dbStore.has(name)) {
db = dbStore.get(name)
afterDBCreated()
} else {
dbStore.set(name, sublevel(levelup(name, opts, function (err) {
/* istanbul ignore if */
if (err) {
dbStore.delete(name)
return callback(err)
}
db = dbStore.get(name)
db._docCount = -1
db._queue = new Deque()
afterDBCreated()
})))
}
function afterDBCreated () {
stores.docStore = db.sublevel(DOC_STORE, {valueEncoding: safeJsonEncoding})
stores.bySeqStore = db.sublevel(BY_SEQ_STORE, {valueEncoding: 'json'})
stores.attachmentStore =
var leveldown = opts.db;
var dbStore;
var leveldownName = functionName(leveldown);
if (dbStores.has(leveldownName)) {
dbStore = dbStores.get(leveldownName);
} else {
dbStore = new Map();
dbStores.set(leveldownName, dbStore);
}
if (dbStore.has(name)) {
db = dbStore.get(name);
afterDBCreated();
} else {
dbStore.set(name, sublevel(levelup(leveldown(name), opts, function (err) {
/* istanbul ignore if */
if (err) {
dbStore.delete(name);
return callback(err);
}
db = dbStore.get(name);
db._docCount = -1;
db._queue = new Deque();
/* istanbul ignore else */
if (typeof opts.migrate === 'object') { // migration for leveldown
opts.migrate.doMigrationOne(name, db, afterDBCreated);
} else {
afterDBCreated();
}
})));
}