Allow setPath to take a function for its label argument