fix nested remoting function throwing error will crash app

Signed-off-by: Clark Wang <clark.wangs@gmail.com>
test if cb exists

Signed-off-by: Clark Wang <clark.wangs@gmail.com>
fix jshint errors

Signed-off-by: Clark Wang <clark.wangs@gmail.com>
Merge pull request #907 from clarkorz/fix/nestRemoting-crash

fix nested remoting function throwing error will crash app
v2.8.5
Merge branch 'release/2.8.5' into production
Merge tag 'v2.8.5'

2.8.5

 * fix jshint errors (Clark Wang)

 * test if cb exists (Clark Wang)

 * fix nested remoting function throwing error will crash app (Clark Wang)

 * Fix bcrypt issues for browserify (Raymond Feng)
Rework phased middleware, fix several bugs

Bugs fixed:

 - express helpers like `req.get` are now available in middleware
   handlers registered via `app.middleware`

 - `req.url` does not include the mountpath prefix now, this is
   consistent with the behaviour of `app.use`

The implementation of phased middleware was completely rewritten.
 - We no longer use Phase and PhaseList objects from loopback-phase.
 - Handler functions are registered via the `Layer` mechanism used by
   express router.
 - The app keeps the layers sorted according to phases.