Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let PouchDB;
if (process.browser) {
PouchDB = require('pouchdb').default;
PouchDB.plugin(require('pouchdb-find').default);
PouchDB.plugin(require('pouchdb-upsert'));
} else {
PouchDB = require('pouchdb');
PouchDB.plugin(require('pouchdb-find'));
PouchDB.plugin(require('pouchdb-upsert'));
}
class ElementPouchDB {
constructor({ name }) {
this.dbName = name;
this.db = new PouchDB(this.dbName);
try {
this.db.createIndex({
index: { fields: ['type', 'anchorFileHash', 'operationHash', 'batchFileHash'] },
});