Socket
Socket
Sign inDemoInstall

optimist

Package Overview
Dependencies
1
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.2.7 to 0.2.8

2

index.js

@@ -394,3 +394,3 @@ var path = require('path');

var n = Number(arg);
argv._.push(isNaN(n) ? arg : n);
argv._.push(flags.strings['_'] || isNaN(n) ? arg : n);
}

@@ -397,0 +397,0 @@ }

{
"name" : "optimist",
"version" : "0.2.7",
"version" : "0.2.8",
"description" : "Light-weight option parsing with an argv hash. No optstrings attached.",

@@ -18,2 +18,5 @@ "main" : "./index.js",

},
"scripts" : {
"test" : "expresso"
},
"repository" : {

@@ -20,0 +23,0 @@ "type" : "git",

var optimist = require('../index');
var assert = require('assert');
var path = require('path');
var localExpresso = path.normalize(
__dirname + '/../node_modules/.bin/expresso'
);
var expresso = process.argv[1] === localExpresso
? 'node ./node_modules/.bin/expresso'
: 'expresso'
;
exports['short boolean'] = function () {
var parse = optimist.parse([ '-b' ]);
assert.eql(parse, { b : true, _ : [], $0 : 'expresso' });
assert.eql(parse, { b : true, _ : [], $0 : expresso });
assert.eql(typeof parse.b, 'boolean');

@@ -13,3 +23,3 @@ };

optimist.parse([ '--bool' ]),
{ bool : true, _ : [], $0 : 'expresso' }
{ bool : true, _ : [], $0 : expresso }
);

@@ -21,3 +31,3 @@ };

optimist.parse([ 'foo', 'bar', 'baz' ]),
{ _ : [ 'foo', 'bar', 'baz' ], $0 : 'expresso' }
{ _ : [ 'foo', 'bar', 'baz' ], $0 : expresso }
);

@@ -29,3 +39,3 @@ };

optimist.parse([ '-cats' ]),
{ c : true, a : true, t : true, s : true, _ : [], $0 : 'expresso' }
{ c : true, a : true, t : true, s : true, _ : [], $0 : expresso }
);

@@ -37,3 +47,3 @@ };

optimist.parse([ '-cats', 'meow' ]),
{ c : true, a : true, t : true, s : 'meow', _ : [], $0 : 'expresso' }
{ c : true, a : true, t : true, s : 'meow', _ : [], $0 : expresso }
);

@@ -45,3 +55,3 @@ };

optimist.parse([ '-h', 'localhost' ]),
{ h : 'localhost', _ : [], $0 : 'expresso' }
{ h : 'localhost', _ : [], $0 : expresso }
);

@@ -53,3 +63,3 @@ };

optimist.parse([ '-h', 'localhost', '-p', '555' ]),
{ h : 'localhost', p : 555, _ : [], $0 : 'expresso' }
{ h : 'localhost', p : 555, _ : [], $0 : expresso }
);

@@ -61,3 +71,3 @@ };

optimist.parse([ '--pow', 'xixxle' ]),
{ pow : 'xixxle', _ : [], $0 : 'expresso' }
{ pow : 'xixxle', _ : [], $0 : expresso }
);

@@ -69,3 +79,3 @@ };

optimist.parse([ '--pow=xixxle' ]),
{ pow : 'xixxle', _ : [], $0 : 'expresso' }
{ pow : 'xixxle', _ : [], $0 : expresso }
);

@@ -77,3 +87,3 @@ };

optimist.parse([ '--host', 'localhost', '--port', '555' ]),
{ host : 'localhost', port : 555, _ : [], $0 : 'expresso' }
{ host : 'localhost', port : 555, _ : [], $0 : expresso }
);

@@ -85,3 +95,3 @@ };

optimist.parse([ '--host=localhost', '--port=555' ]),
{ host : 'localhost', port : 555, _ : [], $0 : 'expresso' }
{ host : 'localhost', port : 555, _ : [], $0 : expresso }
);

@@ -95,3 +105,3 @@ };

f : true, p : 555, h : 'localhost',
_ : [ 'script.js' ], $0 : 'expresso',
_ : [ 'script.js' ], $0 : expresso,
}

@@ -106,3 +116,3 @@ );

f : true, p : 555, h : 'localhost',
_ : [ 'script.js' ], $0 : 'expresso',
_ : [ 'script.js' ], $0 : expresso,
}

@@ -115,3 +125,3 @@ );

optimist.parse([ '--no-moo' ]),
{ moo : false, _ : [], $0 : 'expresso' }
{ moo : false, _ : [], $0 : expresso }
);

@@ -123,3 +133,3 @@ };

optimist.parse([ '-v', 'a', '-v', 'b', '-v', 'c' ]),
{ v : ['a','b','c'], _ : [], $0 : 'expresso' }
{ v : ['a','b','c'], _ : [], $0 : expresso }
);

@@ -150,3 +160,3 @@ };

_ : [ 'bare', '--not-a-flag', 'eek' ],
$0 : 'expresso'
$0 : expresso
}

@@ -172,3 +182,3 @@ );

_ : [ 789 ],
$0 : 'expresso'
$0 : expresso
});

@@ -185,3 +195,3 @@ assert.eql(typeof argv.x, 'number');

var parse = optimist([ '-t', 'moo' ]).boolean(['t']).argv;
assert.eql(parse, { t : true, _ : [ 'moo' ], $0 : 'expresso' });
assert.eql(parse, { t : true, _ : [ 'moo' ], $0 : expresso });
assert.eql(typeof parse.t, 'boolean');

@@ -198,3 +208,3 @@ };

_: ['moo'],
$0 : 'expresso'
$0 : expresso
});

@@ -216,3 +226,3 @@

_: ['moo'],
$0 : 'expresso'
$0 : expresso
});

@@ -234,3 +244,3 @@

_ : [ 'one', 'two', 'three' ],
$0 : 'expresso'
$0 : expresso
});

@@ -253,10 +263,19 @@

exports.stringArgs = function () {
var s = optimist([ ' ', ' ' ]).string('_').argv._;
assert.eql(s.length, 2);
assert.eql(typeof s[0], 'string');
assert.eql(s[0], ' ');
assert.eql(typeof s[1], 'string');
assert.eql(s[1], ' ');
};
exports.slashBreak = function () {
assert.eql(
optimist.parse([ '-I/foo/bar/baz' ]),
{ I : '/foo/bar/baz', _ : [], $0 : 'expresso' }
{ I : '/foo/bar/baz', _ : [], $0 : expresso }
);
assert.eql(
optimist.parse([ '-xyz/foo/bar/baz' ]),
{ x : true, y : true, z : '/foo/bar/baz', _ : [], $0 : 'expresso' }
{ x : true, y : true, z : '/foo/bar/baz', _ : [], $0 : expresso }
);

@@ -306,2 +325,2 @@ };

assert.equal(argv.somefalse, false);
};
};
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc