Advertisement
Guest User

Untitled

a guest
Jan 29th, 2015
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var misc = module.exports;
  2.  
  3. function Tasks() {};
  4.  
  5. Tasks.prototype = new Array();
  6.  
  7. Tasks.prototype.findTask = function(task_id) {
  8.     if (task_id.task_id) {
  9.         task_id = task_id.task_id;
  10.     }
  11.     else if (task_id.id) {
  12.         task_id = task_id.id;
  13.     }
  14.     var found = this.filter(function(task) {return task.task._id == task_id});
  15.     if (found.length > 0) {
  16.         return found[0];
  17.     }
  18. }
  19.  
  20. Tasks.prototype.toJSON = function() {
  21.     return this.slice(0);
  22. }
  23.  
  24.  
  25.  
  26. misc.Tasks = Tasks;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement