Skip to content

Commit

Permalink
refactor: used angular.isDefined() instead of typeof !== "undefined"
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnnyTheTank committed Feb 17, 2016
1 parent 85478d1 commit 443a16a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
7 changes: 3 additions & 4 deletions dist/angular-github-api-factory.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
@name: angular-github-api-factory
@version: 0.5.0 (06-01-2016)
@version: 0.5.0 (17-02-2016)
@author: Jonathan Hornung
@url: https://github.com/JohnnyTheTank/angular-github-api-factory#readme
@license: MIT
Expand Down Expand Up @@ -76,7 +76,7 @@ angular.module("jtt_github", [])
this.fillDataInObjectByList = function (_object, _params, _list) {

angular.forEach(_list, function (value, key) {
if (typeof _params[value] !== "undefined") {
if (angular.isDefined(_params[value])) {
_object.object[value] = _params[value];
}
});
Expand All @@ -92,7 +92,7 @@ angular.module("jtt_github", [])
url: "",
};

if (typeof _params.per_page !== "undefined") {
if (angular.isDefined(_params.per_page)) {
githubSearchData.object.per_page = _params.per_page;
}

Expand Down Expand Up @@ -141,7 +141,6 @@ angular.module("jtt_github", [])
githubSearchData.url = this.getApiBaseUrl() + "repos/" + _params.user + "/" + _params.repo + "/events";
break;
}

return githubSearchData;
};
});
4 changes: 2 additions & 2 deletions dist/angular-github-api-factory.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions src/angular-github-api-factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ angular.module("jtt_github", [])
this.fillDataInObjectByList = function (_object, _params, _list) {

angular.forEach(_list, function (value, key) {
if (typeof _params[value] !== "undefined") {
if (angular.isDefined(_params[value])) {
_object.object[value] = _params[value];
}
});
Expand All @@ -85,7 +85,7 @@ angular.module("jtt_github", [])
url: "",
};

if (typeof _params.per_page !== "undefined") {
if (angular.isDefined(_params.per_page)) {
githubSearchData.object.per_page = _params.per_page;
}

Expand Down Expand Up @@ -134,7 +134,6 @@ angular.module("jtt_github", [])
githubSearchData.url = this.getApiBaseUrl() + "repos/" + _params.user + "/" + _params.repo + "/events";
break;
}

return githubSearchData;
};
});

0 comments on commit 443a16a

Please sign in to comment.