Permalink
Browse files

cleanup of NodePie#getLink

  • Loading branch information...
fb55 committed Sep 17, 2011
1 parent b11848c commit 1825596e85d0363ff733a704cafe93d26c696015
Showing with 10 additions and 19 deletions.
  1. +10 −19 lib/nodepie.js
View
@@ -400,34 +400,25 @@ NodePie.prototype.getLink = function(rel, type){
var link = (atom10ns && this.channelElement[atom10ns+":link"]) || this.channelElement.link;
- if(!link){
- return false;
- }
+ if(!link);
- if(typeof link === "string"){
- if(rel === "alternate" && type === "text/html"){
+ else if(typeof link === "string"){
+ if(rel === "alternate" && type === "text/html")
return link.trim();
- }else{
- return false;
- }
}
- if(typeof link === "object" && !Array.isArray(link)){
- if(rel === link.rel && (!link.type || type==link.type)){
- return link.href;
- }else{
- return false;
- }
- }
-
- if(Array.isArray(link)){
+ else if(Array.isArray(link)){
for(var i=0, len = link.length; i<len; i++){
- if(rel === link[i].rel && (!link[i].type || type==link[i].type)){
+ if(rel === link[i].rel && (!link[i].type || type === link[i].type))
return link[i].href;
- }
}
}
+ else if(typeof link === "object"){
+ if(rel === link.rel && (!link.type || type === link.type))
+ return link.href;
+ }
+
return false;
};

0 comments on commit 1825596

Please sign in to comment.