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
9.2.0

8

base.js

@@ -50,4 +50,8 @@ var deprecate = require('deprecate')

Base.prototype.or = function (fallback) {
return this.isValid ? this : new this.constructor(fallback)
Base.prototype.or = function (Opt, fallback) {
if (typeof Opt !== 'function') {
fallback = Opt
Opt = this.constructor
}
return this.isValid ? this : new Opt(fallback)
}

@@ -54,0 +58,0 @@

{
"name": "stdopt",
"version": "9.1.0",
"version": "9.2.0",
"description": "Wrap and validate optional values",

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

@@ -1,2 +0,2 @@

var { nothing } = require('../')
var { opt, nothing } = require('../')
var test = require('tape')

@@ -7,4 +7,6 @@

t.equal(nothing().value(), null)
t.equal(opt().or(nothing).value(), null)
t.equal(nothing(0).or(opt, 1).value(), 1)
t.throws(() => nothing(0).value(), /Value 0 cannot be parsed as nothing/)
t.end()
})