Comparing version
@@ -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() | ||
}) |
18626
0.16%