mjijackson/strata — pull request #37 by jeffbski (2012-11-12 13:41:04+00:00)
Title: build should only use app as cb if cb is undefined

build(app, cb) was defined to allow app to be optional, but it should
only shift the arguments if cb is undefined not simply if app is a function
(which if it is passed in, it is always a fn).

Current code would not allow an default app to be passed in, since it
erroneously always shifted it down as a callback.

Changed:

```javascript
// build.js
module.exports = function (app, callback) {
// broken, since if app is passed it is also a fn
if (typeof app === 'function') {
callback = app;
app = null;
}
```
to

```javascript
// build.js
module.exports = function (app, callback) {
// properly check both before shifting
if (typeof callback === 'undefined' && typeof app === 'function') {
callback = app;
app = null;
}
```

By adding the cb is undefined check we can support the following build signatures:

- build()
- build(app, cb)
- build(cb)
- build(app, null)

Added tests to describe and verify these extra 3 scenarios.