Permalink
Browse files

better example

  • Loading branch information...
1 parent 28828a7 commit 21c5cf4e7566ff14a96febec8581f23789cdd157 @tj committed May 2, 2011
Showing with 25 additions and 2 deletions.
  1. +25 −2 examples/social-graph.js
@@ -76,7 +76,30 @@ jane.save(function(){
loki.follow(tobi);
loki.follow(jane);
jane.follow(tobi);
+
+ tobi.followers(function(err, users){
+ console.log();
+ console.log(' tobi has %d followers: ', users.length);
+ display(users);
+ });
+
+ tobi.follows(function(err, users){
+ console.log();
+ console.log(' tobi is following %d users: ', users.length);
+ display(users);
+ });
+
tobi.friends(function(err, users){
- console.log(users);
+ console.log();
+ console.log(' tobi has %d friend:', users.length);
+ display(users);
+ console.log();
+ client.end();
+ });
+});
+
+function display(users) {
+ users.forEach(function(user){
+ console.log(' - %s', user.name);
});
-});
+}

0 comments on commit 21c5cf4

Please sign in to comment.