ekalinin/sitemap.js — pull request #11 by giggio (2014-06-26 13:25:55+00:00)
Title: Allow toXML to be called sync, respect conventions

The toXML method currently takes a callback with only one argument, the xml. Node's convention demands that the callback take an error, and then the result.

All toXML is doing is calling `toString`, so there is no need for the method to be async, it wrongly implies that there is a difference between the sync and async version. But at this moment removing this method would break existing users.

This PR makes toXML optionally sync, if no callback is passed on. If one is passed, it verifies if the callback expects one or two arguments, effectively emulating the previous behavior, while still allowing correct node convetions with error and result being passed to the callback.

Expresso was also updated to better allow for async tests.