When passing around functions the term "predicate" is often used for a [short] function that returns a boolean. Is there a term for a function that selects a single field on an object?
For example let's say we build a custom sort function, but this sort is generic so it takes an argument for the user to specify which field to sort on. Such a function might look something like:
The items might be an array of objects with a filename property.
If I were to sort based on filename with the function I might invoke a call like:
sort(items, a => a.filename)
This second argument...is there a special name for this type of function that selects a property?
I'm trying to figure out a good way to name this second argument.