semver-store
Advanced tools
Comparing version 0.2.2 to 0.3.0
@@ -31,2 +31,5 @@ 'use strict' | ||
}) | ||
.add('get (wildcard)', function () { | ||
store1.get('*') | ||
}) | ||
.add('get (minor wildcard)', function () { | ||
@@ -33,0 +36,0 @@ store1.get('1.x') |
@@ -27,2 +27,3 @@ 'use strict' | ||
if (typeof version !== 'string') return null | ||
if (version === '*') version = 'x.x.x' | ||
var node = this.tree | ||
@@ -29,0 +30,0 @@ var firstDot = version.indexOf('.') |
{ | ||
"name": "semver-store", | ||
"version": "0.2.2", | ||
"version": "0.3.0", | ||
"description": "An extremely fast semver based store", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -30,3 +30,3 @@ # semver-store | ||
Get a document from the store with the specified version.<br/> | ||
The version string could be a full version string or specify a range, such as `1.x`, in which case the highest version compatible will be returned. | ||
The version string could be a full version string or specify a range, such as `1.x`, in which case the highest version compatible will be returned. Specify `*` to get the highest version available. | ||
@@ -33,0 +33,0 @@ #### `del(version)` |
39
test.js
@@ -129,2 +129,41 @@ 'use strict' | ||
test('Should get the leaf (wildcard) / 5', t => { | ||
t.plan(1) | ||
const store = SemVerStore() | ||
store | ||
.set('1.0.0', 1) | ||
.set('1.0.1', 2) | ||
.set('1.0.2', 3) | ||
t.strictEqual(store.get('*'), 3) | ||
}) | ||
test('Should get the leaf (wildcard) / 6', t => { | ||
t.plan(1) | ||
const store = SemVerStore() | ||
store | ||
.set('1.0.0', 1) | ||
.set('1.1.0', 2) | ||
.set('1.0.2', 3) | ||
t.strictEqual(store.get('*'), 2) | ||
}) | ||
test('Should get the leaf (wildcard) / 7', t => { | ||
t.plan(1) | ||
const store = SemVerStore() | ||
store | ||
.set('2.0.0', 1) | ||
.set('1.1.0', 2) | ||
.set('2.0.2', 3) | ||
t.strictEqual(store.get('*'), 3) | ||
}) | ||
test('Missing patch', t => { | ||
@@ -131,0 +170,0 @@ t.plan(1) |
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
18697
660