0.1.4 Fix undefined/null return bug
parent
6ec7fece2b
commit
9d9c681689
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@uci-utils/to-boolean",
|
||||
"version": "0.1.3",
|
||||
"version": "0.1.4",
|
||||
"description": "function to return a boolean value from sets of default values",
|
||||
"main": "src/boolean.js",
|
||||
"scripts": {
|
||||
|
|
|
@ -5,8 +5,8 @@ function createBoolean (opts={}) {
|
|||
return (value => {
|
||||
if (opts.addTrue) rTrue = rTrue.concat(opts.addTrue)
|
||||
if (opts.addFalse) rFalse = rFalse.concat(opts.addFalse)
|
||||
if (value===undefined) return opts.undefined==='same' ? undefined : opts.undefined || false
|
||||
if (value===null) return opts.null==='same' ? null : opts.null || false
|
||||
if (value===undefined) return opts.undefined==='same' ? undefined : (opts.undefined || false)
|
||||
if (value===null) return opts.null==='same' ? null : (opts.null || false)
|
||||
if (!isNaN(Number(value))) return (opts.number==='default' ? !!value : (Number(value) > (opts.number || 0)? true : false))
|
||||
if (typeof value==='string') {
|
||||
value = value.trim()
|
||||
|
|
Loading…
Reference in New Issue