Socket
Socket
Sign inDemoInstall

jackspeak

Package Overview
Dependencies
8
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.0 to 1.2.0

22

index.js

@@ -282,3 +282,3 @@ 'use strict'

`Environment variable ${name} must be set to 0 or 1 only`)
return e === '' ? false : !!+e
return !!+e
}

@@ -288,4 +288,3 @@

const addEnv = (j, name, val) => {
assertNotDefined(j, name)
const envVal = (j, name, val) => {
if (!j.env)

@@ -303,6 +302,6 @@ j.env = process.env

if (!has)
j.result[name] = []
return []
else {
const split = e.split(val.delimiter)
j.result[name] = isFlag(val) ? countBools(split.map(envToBool(name)))
return isFlag(val) ? countBools(split.map(envToBool(name)))
: isNum(val) ? split.map(envToNum(name, val)).filter(e => e !== undefined)

@@ -312,8 +311,12 @@ : split

} else if (isFlag(val))
j.result[name] = envToBool(name)(e)
return envToBool(name)(e)
else if (isNum(val))
j.result[name] = envToNum(name, val)(e)
return envToNum(name, val)(e)
else
j.result[name] = e
return e
}
const addEnv = (j, name, val) => {
assertNotDefined(j, name)
j.result[name] = envVal(j, name, val)
addHelpText(j, name, val)

@@ -328,2 +331,5 @@ }

assertNotDefined(j, name)
if (val.envDefault)
val.default = envVal(j, val.envDefault, val)
if (isFlag(val))

@@ -330,0 +336,0 @@ addFlag(j, name, val)

{
"name": "jackspeak",
"version": "1.1.0",
"version": "1.2.0",
"description": "A very strict and proper argument parser.",

@@ -8,4 +8,4 @@ "main": "index.js",

"build-examples": "for i in examples/*.js ; do node $i -h > ${i/.js/.txt}; done",
"snap": "TAP_SNAPSHOT=1 tap test/*.js && npm run build-examples",
"test": "tap test/*.js --100",
"snap": "TAP_SNAPSHOT=1 tap test/*.js -J && npm run build-examples",
"test": "tap test/*.js --100 -J",
"preversion": "npm test",

@@ -17,3 +17,3 @@ "postversion": "npm publish",

"devDependencies": {
"tap": "^12.1.1"
"tap": "^12.5.0"
},

@@ -20,0 +20,0 @@ "files": [

@@ -81,2 +81,7 @@ # jackspeak

- `envDefault` - The name of an environment variable which provides
the default value for this flag. The environment variable will
be parsed as an `env(flag(...))` value, with `'1'` for true and
`'0'` for false.
- `short` - A "short" form of the value which is indicated

@@ -109,2 +114,5 @@ with a single dash. If `short` is a single character, then

- `envDefault` - The name of an environment variable which provides
the default value for this opt.
- `valid` - An array of valid values. If the user provides a

@@ -111,0 +119,0 @@ value outside this set, it will throw an error.

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc