Javascript version of Laravel Validator