Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/* global PouchDB */
// this code only runs in the browser, as its own dist/ script
import FruitdownPouchPlugin from 'pouchdb-adapter-fruitdown';
import { guardedConsole } from 'pouchdb-utils';
if (typeof PouchDB === 'undefined') {
guardedConsole('error', 'fruitdown adapter plugin error: ' +
'Cannot find global "PouchDB" object! ' +
'Did you remember to include pouchdb.js?');
} else {
PouchDB.plugin(FruitdownPouchPlugin);
}
/* global PouchDB */
import LocalStoragePouchPlugin from 'pouchdb-adapter-localstorage';
import { guardedConsole } from 'pouchdb-utils';
var PDB = (typeof PouchDB !== 'undefined') ? PouchDB : require('pouchdb');
if (!PDB) {
guardedConsole('error', 'localstorage adapter plugin error: ' +
'Cannot find global "PouchDB" object! ' +
'Did you remember to include pouchdb.js?');
} else {
LocalStoragePouchPlugin(PDB);
}
return function (event) {
guardedConsole('error', 'WebSQL threw an error', event);
// event may actually be a SQLError object, so report is as such
var errorNameMatch = event && event.constructor.toString()
.match(/function ([^(]+)/);
var errorName = (errorNameMatch && errorNameMatch[1]) || event.type;
var errorReason = event.target || event.message;
callback(createError(WSQ_ERROR, errorReason, errorName));
};
}
/* global PouchDB */
// this code only runs in the browser, as its own dist/ script
import MemoryPouchPlugin from 'pouchdb-adapter-memory';
import { guardedConsole } from 'pouchdb-utils';
if (typeof PouchDB === 'undefined') {
guardedConsole('error', 'memory adapter plugin error: ' +
'Cannot find global "PouchDB" object! ' +
'Did you remember to include pouchdb.js?');
} else {
PouchDB.plugin(MemoryPouchPlugin);
}
/* global PouchDB */
// this code only runs in the browser, as its own dist/ script
import FruitdownPouchPlugin from 'pouchdb-adapter-fruitdown';
import { guardedConsole } from 'pouchdb-utils';
if (typeof PouchDB === 'undefined') {
guardedConsole('error', 'fruitdown adapter plugin error: ' +
'Cannot find global "PouchDB" object! ' +
'Did you remember to include pouchdb.js?');
} else {
PouchDB.plugin(FruitdownPouchPlugin);
}
/* global PouchDB */
import FruitdownPouchPlugin from 'pouchdb-adapter-fruitdown';
import { guardedConsole } from 'pouchdb-utils';
var PDB = (typeof PouchDB !== 'undefined') ? PouchDB : require('pouchdb');
if (!PDB) {
guardedConsole('error', 'fruitdown adapter plugin error: ' +
'Cannot find global "PouchDB" object! ' +
'Did you remember to include pouchdb.js?');
} else {
FruitdownPouchPlugin(PDB);
}
/* global PouchDB */
// this code only runs in the browser, as its own dist/ script
import LocalStoragePouchPlugin from 'pouchdb-adapter-localstorage';
import { guardedConsole } from 'pouchdb-utils';
if (typeof PouchDB === 'undefined') {
guardedConsole('error', 'localstorage adapter plugin error: ' +
'Cannot find global "PouchDB" object! ' +
'Did you remember to include pouchdb.js?');
} else {
PouchDB.plugin(LocalStoragePouchPlugin);
}
function emitError(db, e) {
try {
db.emit('error', e);
} catch (err) {
guardedConsole('error',
'The user\'s map/reduce function threw an uncaught error.\n' +
'You can debug this error by doing:\n' +
'myDatabase.on(\'error\', function (err) { debugger; });\n' +
'Please double-check your map/reduce function.');
guardedConsole('error', e);
}
}
function emitError(db, e) {
try {
db.emit('error', e);
} catch (err) {
guardedConsole('error',
'The user\'s map/reduce function threw an uncaught error.\n' +
'You can debug this error by doing:\n' +
'myDatabase.on(\'error\', function (err) { debugger; });\n' +
'Please double-check your map/reduce function.');
guardedConsole('error', e);
}
}
Object.keys(doc._attachments).forEach(function (name) {
attachmentError = attachmentError || attachmentNameError(name);
if (!doc._attachments[name].content_type) {
guardedConsole('warn', 'Attachment', name, 'on document', doc._id, 'is missing content_type');
}
});
}