Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Replaced == with === (because it's faster & safer)

  • Loading branch information...
commit ed31c95eb3a0f8dddd3beea5a11fba2fa11bfb7c 1 parent 8bee66f
@fb55 fb55 authored
Showing with 25 additions and 25 deletions.
  1. +25 −25 lib/nodepie.js
View
50 lib/nodepie.js
@@ -137,11 +137,11 @@ NodePie._walkForNS = function(node, that, depth){
var keys = Object.keys(node), key;
for(var i=0, len = keys.length; i<len; i++){
key = keys[i];
- if(typeof node[key] == "string"){
- if(key.trim().substr(0,6).toLowerCase() == "xmlns:"){
+ if(typeof node[key] === "string"){
+ if(key.trim().substr(0,6).toLowerCase() === "xmlns:"){
that.namespaces[node[key]] = key.trim().substr(6);
}
- }else if(node[key] && typeof node[key] == "object"){
+ }else if(node[key] && typeof node[key] === "object"){
NodePie._walkForNS(node[key], that, depth+1);
}
}
@@ -264,13 +264,13 @@ NodePie.prototype._parseContents = function(str){
return false;
}
- if(typeof str == "string"){
+ if(typeof str === "string"){
str = str.trim();
return str && this._formatStr(str) || false;
}
- if(typeof str == "object"){
- if(typeof str.$t == "string"){
+ if(typeof str === "object"){
+ if(typeof str.$t === "string"){
str.$t = str.$t.trim();
return str.$t && this._formatStr(str.$t) || false;
}
@@ -414,16 +414,16 @@ NodePie.prototype.getLink = function(rel, type){
return false;
}
- if(typeof link == "string"){
- if(rel == "alternate" && type == "text/html"){
+ 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)){
+ if(typeof link === "object" && !Array.isArray(link)){
+ if(rel === link.rel && (!link.type || type==link.type)){
return link.href;
}else{
return false;
@@ -432,7 +432,7 @@ NodePie.prototype.getLink = function(rel, type){
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;
}
}
@@ -498,7 +498,7 @@ NodePie.prototype.getItemQuantity = function(max){
if(this.itemsElement){
if(Array.isArray(this.itemsElement))
this._item_count = this.itemsElement.length;
- else if(typeof this.itemsElement == "object")
+ else if(typeof this.itemsElement === "object")
this._item_count = 1;
}
@@ -561,7 +561,7 @@ NodePie.prototype.getItem = function(i){
}
}
- if(typeof this.itemsElement == "object"){
+ if(typeof this.itemsElement === "object"){
if(i === 0){
this._items[i] = new NodePie.Item(this.itemsElement, this);
return this._items[i];
@@ -649,16 +649,16 @@ NodePie.Item.prototype.getLink = function(rel, type){
return false;
}
- if(typeof link == "string"){
- if(rel == "alternate" && type == "text/html"){
+ 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)){
+ if(typeof link === "object" && !Array.isArray(link)){
+ if(rel === link.rel && (!link.type || type==link.type)){
return link.href;
}else{
return false;
@@ -667,7 +667,7 @@ NodePie.Item.prototype.getLink = function(rel, type){
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;
}
}
@@ -727,11 +727,11 @@ NodePie.Item.prototype.getAuthors = function(){
author = this.element[dcns+":creator"];
}
- if(typeof author == "string"){
+ if(typeof author === "string"){
return [this._parseAuthor(author)];
}
- if(typeof author == "object"){
+ if(typeof author === "object"){
if(Array.isArray(author)){
for(var i=0, len = author.length; i<len; i++){
if(author[i] && author[i].name){
@@ -739,7 +739,7 @@ NodePie.Item.prototype.getAuthors = function(){
}
}
return authors.length ? authors : false;
- }else if(typeof author.name == "string"){
+ }else if(typeof author.name === "string"){
return [this._parseAuthor(author.name)];
}
}
@@ -901,12 +901,12 @@ NodePie.Item.prototype.getCategories = function(){
return false;
}
- if(typeof category == "string"){
+ if(typeof category === "string"){
category = category.trim();
return category && [this._formatStr(category)] || false;
}
- if(typeof category == "object" && !Array.isArray(category)){
+ if(typeof category === "object" && !Array.isArray(category)){
category = category.term || category.$t || false;
if(!category){
return false;
@@ -917,13 +917,13 @@ NodePie.Item.prototype.getCategories = function(){
if(Array.isArray(category)){
for(var i=0, len = category.length; i<len; i++){
- if(typeof category[i] == "string"){
+ if(typeof category[i] === "string"){
if(category[i].trim()){
categories.push(category[i].trim());
}
continue;
}
- if(typeof category[i] == "object"){
+ if(typeof category[i] === "object"){
if((category[i].term || category[i].$t || "").trim()){
categories.push(this._formatStr((category[i].term || category[i].$t || "").trim()));
}
Please sign in to comment.
Something went wrong with that request. Please try again.