recreate certain functions of underscore