mirror of
https://github.com/Doodle3D/Doodle3D-Core.git
synced 2024-12-22 11:03:48 +01:00
remove db utils
This commit is contained in:
parent
2b84cd0b11
commit
6e1660504b
@ -1,29 +0,0 @@
|
||||
import PouchDB from 'pouchdb';
|
||||
|
||||
export function getLegalDBName(input) {
|
||||
return encodeURIComponent(input.toLowerCase())
|
||||
.replace(/\./g, '%2E')
|
||||
.replace(/!/g, '%21')
|
||||
.replace(/~/g, '%7E')
|
||||
.replace(/\*/g, '%2A')
|
||||
.replace(/'/g, '%27')
|
||||
.replace(/\(/g, '%28')
|
||||
.replace(/\)/g, '%29')
|
||||
.replace(/\-/g, '%2D')
|
||||
.toLowerCase()
|
||||
.replace(/(%..)/g, esc => `(${esc.substr(1)})`);
|
||||
}
|
||||
|
||||
export function getDbUrl(db) {
|
||||
if (db.user) {
|
||||
return `${db.protocol}${encodeURIComponent(db.user)}:${encodeURIComponent(db.password)}@${db.host}`;
|
||||
} else {
|
||||
return `${db.protocol}${db.host}`;
|
||||
}
|
||||
}
|
||||
|
||||
const dbs = {};
|
||||
export function getDb(dbUrl) {
|
||||
if (!dbs[dbUrl]) dbs[dbUrl] = new PouchDB(dbUrl);
|
||||
return dbs[dbUrl];
|
||||
}
|
Loading…
Reference in New Issue
Block a user