diff --git a/lib/nopt.js b/lib/nopt.js index 94a983c..119ad4d 100644 --- a/lib/nopt.js +++ b/lib/nopt.js @@ -33,14 +33,16 @@ function nopt (types, shorthands, args, slice) { args = args.slice(slice) var data = {} , key - , remain = [] - , cooked = args - , original = args.slice(0) + , argv = { + remain: [], + cooked: args, + original: args.slice(0) + } - parse(args, data, remain, types, shorthands) + parse(args, data, argv.remain, types, shorthands) // now data is full clean(data, types, exports.typeDefs) - data.argv = {remain:remain,cooked:cooked,original:original} + data.argv = argv Object.defineProperty(data.argv, 'toString', { value: function () { return this.original.map(JSON.stringify).join(" ") }, enumerable: false })