Main constructor function - for undefined, null and NaN returns None. Anything else is wrapped into Some.
undefined
null
NaN
opt(0) // Some(0)opt(1) // Some(1)opt(true) // Some(true)opt('Kagome') // Some('Kagome')opt([]) // Some([])opt([1]) // Some([1])opt({}) // Some({})opt({a: 0}) // Some({a: 0})opt(undefined) // Noneopt(null) // Noneopt(NaN) // None
Main constructor function - for
undefined
,null
andNaN
returns None. Anything else is wrapped into Some.