Move index.js to lib/validate.js

Add check for empty registry url.