New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

stdopt

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stdopt - npm Package Compare versions

Comparing version

to
2.0.3

2

base.js

@@ -13,3 +13,3 @@ var ERR_UNWRAP = 'Invalid optional value: '

}
throw new TypeError(ERR_UNWRAP)
throw new TypeError(ERR_UNWRAP + val)
}

@@ -16,0 +16,0 @@

{
"name": "stdopt",
"version": "2.0.2",
"version": "2.0.3",
"description": "Wrap and validate optional values",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -19,3 +19,3 @@ # stdopt

string(true).or('other text').value() // => 'other text'
string(5).value() // '5'
string(5).value() // => '5'

@@ -22,0 +22,0 @@ // number primitive

@@ -6,8 +6,8 @@ var opt = require('../')

t.equal(opt('value').value(), 'value')
t.throws(opt().value, /Invalid optional value/)
t.throws(opt().value, /Invalid optional value: undefined/)
t.equal(opt('value').or('nope').value(), 'value')
t.equal(opt().or('nope').value(), 'nope')
t.equal(opt().or().or('nope').value(), 'nope')
t.throws(opt().or().value, /Invalid optional value/)
t.throws(opt().or(null).value, /Invalid optional value: null/)
t.end()
})