diff --git a/src/scripts/directives/setting.js b/src/scripts/directives/setting.js index 0f21d6b..9ba2d66 100644 --- a/src/scripts/directives/setting.js +++ b/src/scripts/directives/setting.js @@ -146,7 +146,7 @@ return; } - if ((scope.option.type == 'integer' || scope.option.type == 'float') && (!angular.isUndefined(scope.option.min) || !angular.isUndefined(scope.option.max))) { + if ((scope.option.type == 'integer' || scope.option.type == 'float') && (angular.isDefined(scope.option.min) || angular.isDefined(scope.option.max))) { var number = optionValue; if (scope.option.type == 'integer') { @@ -155,18 +155,18 @@ number = parseFloat(optionValue); } - if (!angular.isUndefined(scope.option.min) && number < scope.option.min) { + if (angular.isDefined(scope.option.min) && number < scope.option.min) { scope.optionStatus.setError('Input number is below min value!', { value: scope.option.min }); return; } - if (!angular.isUndefined(scope.option.max) && number > scope.option.max) { + if (angular.isDefined(scope.option.max) && number > scope.option.max) { scope.optionStatus.setError('Input number is above max value!', { value: scope.option.max }); return; } } - if (!angular.isUndefined(scope.option.pattern) && !(new RegExp(scope.option.pattern).test(optionValue))) { + if (angular.isDefined(scope.option.pattern) && !(new RegExp(scope.option.pattern).test(optionValue))) { scope.optionStatus.setError('Input value is invalid!'); return; } diff --git a/src/scripts/services/aria2RpcService.js b/src/scripts/services/aria2RpcService.js index 46c2ea4..a835e0a 100644 --- a/src/scripts/services/aria2RpcService.js +++ b/src/scripts/services/aria2RpcService.js @@ -128,7 +128,7 @@ if (arguments.length > 2) { for (var i = 2; i < arguments.length; i++) { - if (arguments[i] != null && !angular.isUndefined(arguments[i])) { + if (arguments[i] != null && angular.isDefined(arguments[i])) { finalParams.push(arguments[i]); } } @@ -285,21 +285,21 @@ }, tellActive: function (context) { return invoke(buildRequestContext('tellActive', context, - angular.isUndefined(context.requestParams) ? null : context.requestParams + angular.isDefined(context.requestParams) ? context.requestParams: null )); }, tellWaiting: function (context) { return invoke(buildRequestContext('tellWaiting', context, - angular.isUndefined(context.offset) ? 0 : context.offset, - angular.isUndefined(context.num) ? 1000 : context.num, - angular.isUndefined(context.requestParams) ? null : context.requestParams + angular.isDefined(context.offset) ? context.offset : 0, + angular.isDefined(context.num) ? context.num : 1000, + angular.isDefined(context.requestParams) ? context.requestParams : null )); }, tellStopped: function (context) { return invoke(buildRequestContext('tellStopped', context, - angular.isUndefined(context.offset) ? 0 : context.offset, - angular.isUndefined(context.num) ? 1000 : context.num, - angular.isUndefined(context.requestParams) ? null : context.requestParams + angular.isDefined(context.offset) ? context.offset : 0, + angular.isDefined(context.num) ? context.num : 1000, + angular.isDefined(context.requestParams) ? context.requestParams: null )); }, changePosition: function (context) { diff --git a/src/scripts/services/ariaNgMonitorService.js b/src/scripts/services/ariaNgMonitorService.js index 8b8d072..8bc167f 100644 --- a/src/scripts/services/ariaNgMonitorService.js +++ b/src/scripts/services/ariaNgMonitorService.js @@ -97,7 +97,7 @@ }; var isStorageExist = function (key) { - return !angular.isUndefined(storagesInMemory[key]); + return angular.isDefined(storagesInMemory[key]); }; var pushToStorage = function (key, stat) {