parse_modified.js 317 B

1234567891011121314
  1. var optimist = require('../');
  2. var test = require('tap').test;
  3. test('parse with modifier functions' , function (t) {
  4. t.plan(1);
  5. var argv = optimist().boolean('b').parse([ '-b', '123' ]);
  6. t.deepEqual(fix(argv), { b: true, _: ['123'] });
  7. });
  8. function fix (obj) {
  9. delete obj.$0;
  10. return obj;
  11. }