Add prototype flatten-map function