Minor code cleanup.

Moved the callbacks for bower and npm repos into their own functions.
This moved a bunch of code out of a switch statement, which was getting
difficult to read.

This also eliminted a level of indentation in preparation for another
change.
Fixes #1: checks that version is a valid semver.