implement basic function for map directive