Move duplicated code in util.js to factory function
Move duplicated code in util.js to factory function

dgolovin/developer-platform-install,dgolovin/developer-platform-install,redhat-developer-tooling/developer-platform-install,redhat-developer-tooling/developer-platform-install