js formatting function with esformatter