arkxu/tumblrwks — pull request #4 by 00Davo (2013-07-20 07:23:08+00:00)
Title: Nodeback --- i.e., (err, res) callbacks --- API to address #3

This set of commits patches the tumbrwks request methods so that they treat callbacks as most other Node.js async libraries do, assuming that they take two arguments `(err, res)`, the first representing any error in the asynchronous process and the latter representing the actual returned value. This is important because otherwise it is not possible for users of tumblrwks to handle errors thrown from it cleanly.

The patches also attempt to detect the old single-argument API, `(json)`, and adapt accordingly; this might not be 100% reliable (I'm not sure how reliable `Function.length` is), but it should handle most cases without a problem. (It also shows a deprecation warning so that uses of the old API can be updated!)