🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

nopt

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nopt - npm Package Compare versions

Comparing version

to
2.2.1

5

lib/nopt.js

@@ -129,2 +129,7 @@ // info about each config option.

if (val === true) return false
val = String(val)
var homePattern = process.platform === 'win32' ? /^~(\/|\\)/ : /^~\//
if (val.match(homePattern) && process.env.HOME) {
val = path.resolve(process.env.HOME, val.substr(2))
}
data[k] = path.resolve(String(val))

@@ -131,0 +136,0 @@ return true

2

package.json
{
"name": "nopt",
"version": "2.2.0",
"version": "2.2.1",
"description": "Option parsing for Node, supporting types, shorthands, etc. Used by npm.",

@@ -5,0 +5,0 @@ "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",

@@ -18,2 +18,10 @@ var nopt = require("../")

test("~ path is resolved to $HOME", function (t) {
var path = require("path")
if (!process.env.HOME) process.env.HOME = "/tmp"
var parsed = nopt({key: path}, {}, ["--key=~/val"], 0)
t.same(parsed.key, path.resolve(process.env.HOME, "val"))
t.end()
})
test("other tests", function (t) {

@@ -20,0 +28,0 @@