localstorage-down
Advanced tools
Comparing version 0.5.1 to 0.5.2
@@ -12,3 +12,3 @@ 'use strict'; | ||
this._keys = []; | ||
this._prefix = dbname + '!'; | ||
this._prefix = dbname.replace(/!/g, '!!') + '!'; // escape bangs in dbname | ||
@@ -29,8 +29,3 @@ var prefixLen = this._prefix.length; | ||
LocalStorage.prototype.key = function (keyindex) { | ||
var retVal = this._keys[keyindex]; | ||
if (typeof retVal !== 'undefined') { | ||
// this needs to be a last and first; | ||
retVal = retVal.replace('!bin'); | ||
} | ||
return retVal; | ||
return this._keys[keyindex]; | ||
}; | ||
@@ -37,0 +32,0 @@ |
@@ -15,3 +15,3 @@ { | ||
], | ||
"version": "0.5.1", | ||
"version": "0.5.2", | ||
"main": "index.js", | ||
@@ -18,0 +18,0 @@ "dependencies": { |
@@ -17,3 +17,3 @@ 'use strict'; | ||
tape('test .destroy', function(t) { | ||
tape('test .destroy', function (t) { | ||
var db = levelup('destroy-test', {db: leveldown}); | ||
@@ -48,2 +48,25 @@ var db2 = levelup('other-db', {db: leveldown}); | ||
tape('test escaped db name', function (t) { | ||
var db = levelup('bang!', {db: leveldown}); | ||
var db2 = levelup('bang!!', {db: leveldown}); | ||
db.put('!db1', '!db1', function (err) { | ||
t.notOk(err, 'no error'); | ||
db2.put('db2', 'db2', function (err) { | ||
t.notOk(err, 'no error'); | ||
db.close(function (err) { | ||
t.notOk(err, 'no error'); | ||
db2.close(function (err) { | ||
t.notOk(err, 'no error'); | ||
db = levelup('bang!', {db: leveldown}); | ||
db.get('!db2', function (err, key, value) { | ||
t.ok(err, 'got error'); | ||
t.equal(key, undefined, 'key should be null'); | ||
t.equal(value, undefined, 'value should be null'); | ||
t.end(); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
55361
23
491
0