small collection of utility functions in javascript