Socket
Socket
Sign inDemoInstall

pouchdb-all-dbs

Package Overview
Dependencies
78
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.4 to 0.1.5

2

bower.json
{
"name": "pouchdb-all-dbs",
"main": "dist/pouchdb.all-dbs.js",
"version": "0.1.4",
"version": "0.1.5",
"homepage": "https://github.com/nolanlawson/pouchdb-all-dbs",

@@ -6,0 +6,0 @@ "authors": [

@@ -6,2 +6,16 @@ 'use strict';

var PREFIX = "db_";
function prefixed(dbName) {
//A database name starting with an underscore is valid, but a document
//id starting with an underscore is not in most cases. Because of
//that, they're prefixed in the all dbs database. See issue #7 for
//more info.
return PREFIX + dbName;
}
function unprefixed(dbName) {
return dbName.slice(PREFIX.length);
}
module.exports = function (Pouch) {

@@ -52,2 +66,3 @@

}
dbName = prefixed(dbName);
init();

@@ -73,2 +88,3 @@ queue.add(function (callback) {

}
dbName = prefixed(dbName);
init();

@@ -92,5 +108,7 @@ queue.add(function (callback) {

queue.add(function (callback) {
pouch.allDocs().then(function (res) {
// older versions of this module didn't have prefixes, so check here
var opts = {startkey: PREFIX, endkey: (PREFIX + '\uffff')};
pouch.allDocs(opts).then(function (res) {
var dbs = res.rows.map(function (row) {
return row.key;
return unprefixed(row.key);
});

@@ -97,0 +115,0 @@ callback(null, dbs);

{
"name": "pouchdb-all-dbs",
"version": "0.1.4",
"version": "0.1.5",
"description": "PouchDB allDbs plugin",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -357,3 +357,21 @@ /*jshint expr:true */

});
it('saves databases with names starting with an underscore.', function (done) {
var pouchName = "_" + dbName;
dbs = [pouchName];
// create db
new PouchDB(pouchName, function (err) {
if (err) {
return done(err);
}
PouchDB.allDbs(function (err, allDbs) {
if (err) {
return done(err);
}
allDbs.should.deep.equal(dbs);
done();
});
});
});
});
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc