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
10.0.0

6

base.js

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

var deprecate = require('deprecate')
var inherits = require('inherits')

@@ -45,7 +44,2 @@ var prop = require('stdprop')

Base.unwrap = function (opt) {
deprecate('Base.unwrap()', 'Use the equivalent Base.extract() instead.')
return Base.prototype.extract.call(opt)
}
Base.value = function (opt) {

@@ -52,0 +46,0 @@ return Base.prototype.value.call(opt)

6

list.js
var Base = require('./base')
var apply = require('./util/apply')
var some = require('./opt')
var isArrayish = require('is-arrayish')

@@ -19,3 +20,6 @@

list.parse = function (l, type) {
if (!isArrayish(l)) return
if (!isArrayish(l)) {
if (some(l).isValid) l = [l]
else return
}
if (!type) return Array.from(l)

@@ -22,0 +26,0 @@

{
"name": "stdopt",
"version": "9.4.0",
"version": "10.0.0",
"description": "Wrap and validate optional values",

@@ -10,3 +10,2 @@ "main": "index.js",

"dependencies": {
"deprecate": "^1.1.1",
"inherits": "^2.0.4",

@@ -13,0 +12,0 @@ "is-arrayish": "^0.3.2",

@@ -43,3 +43,4 @@ # stdopt

list([1, 2, 3]).value() // => [1, 2, 3]
list(true).or([4, 5, 6]).value() // => [4, 5, 6]
list('one').value() // => ['one']
list(null).or([4, 5, 6]).value() // => [4, 5, 6]
list({0: 'stuff', length: 1}).value() // => ['stuff']

@@ -46,0 +47,0 @@ ```

@@ -7,6 +7,7 @@ var { list } = require('../')

t.deepEqual(list({ 0: 1, length: 1 }).value(), [1])
t.deepEqual(list('blerf').or([]).value(), [])
t.deepEqual(list('blerf').or({ 0: 1, length: 1 }).value(), [1])
t.throws(() => list(true).value(), /Value true cannot be parsed as list/)
t.deepEqual(list('blerf').or([]).value(), ['blerf'])
t.deepEqual(list(null).or([]).value(), [])
t.deepEqual(list(null).or({ 0: 1, length: 1 }).value(), [1])
t.throws(() => list().value(), /Value undefined cannot be parsed as list/)
t.end()
})