convert ruby style to js