A node port of Processing's map fn