Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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.0 to 0.2.1

7

index.js

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

2

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

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