Created
December 3, 2012 21:27
-
-
Save prabirshrestha/4198227 to your computer and use it in GitHub Desktop.
fbnodify
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var FB = require('fb') | |
| Step = require('step'); | |
| function fbnodify (res) { | |
| if(!res || res.error) throw new Error(JSON.stringify(res)); | |
| this(null, res); | |
| } | |
| function fbnodifybatch (res) { | |
| if(!res || res.error) throw new Error(JSON.stringify(res)); | |
| res.forEach(function (r) { | |
| if(r && r.body) r.body = JSON.parse(r.body); | |
| }); | |
| this(null, res); | |
| } | |
| Step( | |
| function () { | |
| FB.api('4', fbnodify.bind(this)); | |
| }, | |
| function (err, res) { | |
| if(err) throw err; | |
| console.log(res); | |
| } | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment