Groovy implementation of underscorejs functions