yeoman/generator — pull request #198 by passy (2013-03-27 22:47:59+00:00)
Title: Filter option for actions.prompt

I would like to propose a feature I found while digging around in `grunt-init` that did not have an equivalent in Yeoman.

The prompt should accept a `filter` option that allows to sanitize, validate or manipulate the value provided by the user.

### Example Usage

```
var prompts = [{
name: 'title',
message: 'Project Title:',
filter: function (value, cb) {
// Callback expects (err, newValue)
cb(null, value.replace(/jquery/i, 'jQuery'));
}
}];
```

### Benefit

While sanitizing data is already possible after the prompt is finished in the callback, this way makes it clearer to see where the manipulation is happening. Also, this allows to abort early if a value fails to validate.