moving some javascript driver common functions into util