add utility function for javascript