semver-store
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -11,2 +11,5 @@ 'use strict' | ||
SemVerStore.prototype.set = function (version, store) { | ||
if (typeof version !== 'string') { | ||
throw new TypeError('Version should be a string') | ||
} | ||
var currentNode = this.tree | ||
@@ -24,2 +27,3 @@ version = version.split('.') | ||
SemVerStore.prototype.get = function (version) { | ||
if (typeof version !== 'string') return null | ||
var node = this.tree | ||
@@ -46,2 +50,5 @@ var firstDot = version.indexOf('.') | ||
SemVerStore.prototype.del = function (version) { | ||
if (typeof version !== 'string') { | ||
throw new TypeError('Version should be a string') | ||
} | ||
var firstDot = version.indexOf('.') | ||
@@ -48,0 +55,0 @@ var secondDot = version.indexOf('.', firstDot + 1) |
{ | ||
"name": "semver-store", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "An extremely fast semver based store", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
36
test.js
@@ -474,1 +474,37 @@ 'use strict' | ||
}) | ||
test('get with bad type', t => { | ||
t.plan(1) | ||
const store = SemVerStore() | ||
store.set('1.2.3', 1) | ||
t.strictEqual(store.get(5), null) | ||
}) | ||
test('set with bad type', t => { | ||
t.plan(1) | ||
const store = SemVerStore() | ||
try { | ||
store.set(1, 1) | ||
t.fail('Should fail') | ||
} catch (err) { | ||
t.is(err.message, 'Version should be a string') | ||
} | ||
}) | ||
test('del with bad type', t => { | ||
t.plan(1) | ||
const store = SemVerStore() | ||
try { | ||
store.del(1) | ||
t.fail('Should fail') | ||
} catch (err) { | ||
t.is(err.message, 'Version should be a string') | ||
} | ||
}) |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
17748
619
0