Safe language and dom functional pattern extensions for javascript