implementation of _.invoke done using _.map!