Skip to content
Browse files

fixed a bug, removed some loc

  • Loading branch information...
1 parent 6ae74c0 commit a242d5c16b5114bcefa298831cfd2a7b14be9aad @fb55 fb55 committed
Showing with 8 additions and 14 deletions.
  1. +8 −14 lib/nodepie.js
View
22 lib/nodepie.js
@@ -285,7 +285,7 @@ NodePie.prototype._processDate = function(date){
return new Date();
return date;
-}
+};
/************* FEED LEVEL PUBLIC METHODS *************/
@@ -497,9 +497,7 @@ NodePie.prototype.getItems = function(start, length){
if(start >= quantity){
start = quantity-1;
- if(start < 0){
- start = 0;
- }
+ if(start === -1) start = 0;
}
if(length > quantity - start){
@@ -520,24 +518,20 @@ NodePie.prototype.getItems = function(start, length){
* Fetches a NodePie.Item object from defined index or false if out of bounds
**/
NodePie.prototype.getItem = function(i){
- i = i && !isNaN(i) && isFinite(i) || 0;
+ i = i && !isNaN(i) && parseInt(Math.abs(i), 10) || 0;
if(this._items[i]){
return this._items[i];
}
if(Array.isArray(this.itemsElement)){
- if(this.itemsElement.length > i){
- this._items[i] = new NodePie.Item(this.itemsElement[i], this);
- return this._items[i];
- }
+ if(this.itemsElement.length > i)
+ return this._items[i] = new NodePie.Item(this.itemsElement[i], this);
}
else if(typeof this.itemsElement === "object"){
- if(i === 0){
- this._items[i] = new NodePie.Item(this.itemsElement, this);
- return this._items[i];
- }
+ if(i === 0)
+ return this._items[i] = new NodePie.Item(this.itemsElement, this);
}
return false;
@@ -716,7 +710,7 @@ NodePie.Item.prototype.getAuthors = function(){
* title = item.getTitle();
**/
NodePie.Item.prototype.getTitle = function(){
- return this._parseContents(this.element.title);
+ return this._parseContents( this.element.title );
};
/**

0 comments on commit a242d5c

Please sign in to comment.
Something went wrong with that request. Please try again.