Socket
Socket
Sign inDemoInstall

semver-store

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

semver-store - npm Package Compare versions

Comparing version 0.2.2 to 0.3.0

3

bench.js

@@ -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('.')

2

package.json
{
"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)`

@@ -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)

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc