Is there a way to whitelist a property value in expressjs? IE I would like to limit a properties values to either a Boolean true/false or the string 'true'/'false'.
Because truthy sucks in JS I cannot just do this
var foo = Boolean(req.param('foo'));
Since the string 'false' evaluates to true.
Looking to simplify this, however also wondering if there is something built in to expressjs or multer/busboy that I am missin:
var fooParam = req.param('foo');
var foo;
if (fooParam === 'true' || fooParam === 'false') {
foo = fooParam === 'true;
} else if (fooParam === true || fooParam === false) {
foo = fooParam;
}