Skip to content

Instantly share code, notes, and snippets.

@prabirshrestha
Created December 3, 2012 21:27
Show Gist options
  • Save prabirshrestha/4198227 to your computer and use it in GitHub Desktop.
Save prabirshrestha/4198227 to your computer and use it in GitHub Desktop.
fbnodify
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