New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

posix-getopt

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

posix-getopt - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

4

lib/getopt.js

@@ -37,3 +37,3 @@ /*

*/
function goBasicParser(optstring, argv)
function goBasicParser(optstring, argv, optind)
{

@@ -50,3 +50,3 @@ var ii;

this.gop_aliases = {};
this.gop_optind = 2;
this.gop_optind = optind !== undefined ? optind : 2;
this.gop_subind = 0;

@@ -53,0 +53,0 @@

{
"name": "posix-getopt",
"version": "1.1.0",
"version": "1.2.0",
"description": "POSIX-style getopt()",

@@ -9,2 +9,5 @@ "author": "Dave Pacheco (dap@cs.brown.edu)",

},
"scripts": {
"test": "for f in tests/*.js; do echo \"$f\"; node \"$f\" || exit 1; done"
},
"main": "./lib/getopt",

@@ -11,0 +14,0 @@ "repository": {

@@ -138,3 +138,3 @@

### `new getopt.BasicParser(optstring, argv)`
### `new getopt.BasicParser(optstring, argv[, optind])`

@@ -145,5 +145,7 @@ Instantiates a new object for parsing the specified arguments using the

getopt() method to iterate the options as they would in C. (This interface
allows the same option to be specified multiple times.) The first two arguments
in "argv" are ignored, since they generally denote the path to the node
executable and the script being run, so options start with the third element.
allows the same option to be specified multiple times.) The optional 3rd
argument to the constructor `optind` is the number of arguments from `argv` to
skip. By default `optind` is set to `2`, so the first two arguments in `argv`
are ignored, since they generally denote the path to the node executable and
the script being run.

@@ -150,0 +152,0 @@ The option string consists of an optional leading ":" (see below) followed by a

/*
* Tests getopt() itself.
*/
var mod_path = require('path');
var mod_sys = require('sys');
var mod_getopt = require('..');

@@ -71,2 +68,17 @@ var mod_assert = require('assert');

]
}, {
optstr: 'h',
argv: ['-h'],
result: [
{ option: 'h' },
],
optind: 0
}, {
optstr: 'hv',
argv: ['foo', '-h', '-v' ],
result: [
{ option: 'h' },
{ option: 'v' },
],
optind: 1
}];

@@ -79,3 +91,3 @@

parser = new mod_getopt.BasicParser(test_cases[ii].optstr,
test_cases[ii].argv);
test_cases[ii].argv, test_cases[ii].optind);
console.log(parser.gop_tokens);

@@ -82,0 +94,0 @@

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc