src/ngIpAddress.vanilla.js
Function ngIpAddress
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function ngIpAddress() {
return {
restrict: 'A',
require: '?ngModel',
link: function(scope, element, attrs, ngModelCtrl) {
Function link
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
link: function(scope, element, attrs, ngModelCtrl) {
if (!ngModelCtrl) {
return;
}
Consider simplifying this complex logical expression. Open
Open
if ((event.which < 46 && event.which !== 0 && event.which !== 8 && event.which !== 13)
|| event.which === 47
|| event.which > 57 && !(ctrlDown && (event.which === 99 || event.which === 118 || event.which === 120))) {
// Stop key press from propagating
event.preventDefault();
Function evalInput
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function evalInput(val) {
// If val is falsy (undefined, empty string, etc)...
if (!val) {
// Set the field validity to true since it should be the responsibility of 'required' to stop blank entries
ngModelCtrl.$setValidity('ipAddress', true);