What is the naming convention for a function that returns a function?

function getPerformActionFunction(someParameter) { return function() { performAction(someParameter); } } 

What would you call getPerformActionFunction to indicate that it is not performing an action, but returning a function that performs the action?

An example of Javascript, and if there is a Javascript convention that is preferred but also interested in other languages, if the answer is different.

+4
source share
1 answer

Not sure if this is in any style guides, but I really like the -er suffix to suggest something that can do the action.

eg. getActionPerformer or fooHandler or XMLTransformer

I used this style in C #, Java and Clojure, it seems to work fine.

+5
source

Source: https://habr.com/ru/post/1387597/


All Articles