Permalink
Browse files

github.helpers.events will no longer return duplicate events.

This is not accurate to the API.
  • Loading branch information...
1 parent e8f4800 commit 58476160f94b06e0afc3d74a18a9a9d4c75adb86 Aaron Acerboni committed Apr 19, 2012
Showing with 5 additions and 2 deletions.
  1. +5 −2 github/extensions/helpers/helpers.js
@@ -7,19 +7,22 @@
// Requires a github user name and an event type.
//
// This method should take into account for duplicate
- // watch events of the same repo
+ // watch events of the same repo.
//
// Option parameters:
// limit
+
github.helpers.events = function(user, type, options) {
var deferred = new github.utils.deferred(),
promise = deferred.promise(),
events = [],
+ captured = {},
found = 0,
limit = options.limit || Infinity;
github.users(user + '/events').until2(function (item) {
- if(item.type === type){
+ if(item.type === type && !captured.hasOwnProperty(item.repo.name)){
+ captured[item.repo.name] = true;
events.push(item);
found++;
}

0 comments on commit 5847616

Please sign in to comment.