Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ Options with a value:
The function is executed when the option is parsed. It is similar to the reviver parameter of the `JSON.parse()` function. This is the right place where you can validate the input data and `fail()` if it's not valid. For example, if the option requires a number you can validate the range here.

```javascript
.option ({ long: "name", metavar: "STR", reviver: function (value){
.option ({ long: "name", metavar: "STR", reviver: function (value, option){
return value + "bar";
}})
```
Expand Down
2 changes: 1 addition & 1 deletion lib/argp.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ Argp.prototype._newOption = function (o){

//Use the reviver, if any
if (o.opt.reviver){
o.value = o.opt.reviver.call (this, o.value);
o.value = o.opt.reviver.call (this, o.value, o.long || o.short);
}
}else if (o.value === undefined){
//Undefined and no input value, set null
Expand Down