{"action":"opened","issue":{"url":"https://api.github.com/repos/3lvis/Validation/issues/4","labels_url":"https://api.github.com/repos/3lvis/Validation/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/3lvis/Validation/issues/4/comments","events_url":"https://api.github.com/repos/3lvis/Validation/issues/4/events","html_url":"https://github.com/3lvis/Validation/issues/4","id":109668591,"number":4,"title":"Mojolicious Validators","user":{"login":"3lvis","id":1088217,"avatar_url":"https://avatars.githubusercontent.com/u/1088217?v=3","gravatar_id":"","url":"https://api.github.com/users/3lvis","html_url":"https://github.com/3lvis","followers_url":"https://api.github.com/users/3lvis/followers","following_url":"https://api.github.com/users/3lvis/following{/other_user}","gists_url":"https://api.github.com/users/3lvis/gists{/gist_id}","starred_url":"https://api.github.com/users/3lvis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/3lvis/subscriptions","organizations_url":"https://api.github.com/users/3lvis/orgs","repos_url":"https://api.github.com/users/3lvis/repos","events_url":"https://api.github.com/users/3lvis/events{/privacy}","received_events_url":"https://api.github.com/users/3lvis/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-10-04T08:02:27Z","updated_at":"2015-10-04T08:02:27Z","closed_at":null,"body":"http://mojolicio.us/perldoc/Mojolicious/Validator\r\n\r\n`validation.required('phone').len(8, 14).is_phone_number`\r\n\r\nhttps://github.com/kraih/mojo/blob/master/lib/Mojolicious/Validator/Validation.pm\r\n\r\nhttps://github.com/kraih/mojo/blob/master/lib/Mojolicious/Validator.pm\r\n\r\n```\r\nRawEditGraphNewPowered by Mojopaste\r\n  var validator = new Validator();\r\n\r\n  validator.add_check(\r\n    is_country => sub {\r\n      my ($validation, $name, $value) = @_;\r\n      MCT::Model::Countries.name_from_code($value) ? undef : ['country'];\r\n    }\r\n  );\r\n\r\n  validator.add_check(\r\n    is_phone_number => function(name, value, first_arg, second_arg) {\r\n      $value =~ s!\\D!!g; # more non-digits\r\n      return undef if $value =~ /^\\+?\\d{8,14}$/;\r\n      return ['phone_number'];\r\n    },\r\n  );\r\n\r\n\r\n  var validation = validator.validation();\r\n  validation.validator.xxx()\r\n  validation.required('phone').len(8, 14).is_phone_number;\r\n```"}}