refactor(input): wrapped validation logic in helper function

I feel this makes the code more readable, but I suppose that's debatable. It cuts 476b off `.min` and 72b off `.min.gz`

Also included:

I moved `var min = parseFloat(attr.min);` and `var max = parseFloat(attr.max);` out of their validation function, since they only need to be evaluated once.

I moved `function validateRegex(...` inside the if block that uses it.

If you'd like these split up into separate PR's I can do that.