title: Is there a standard way to name functions which returns another function?
body: <p>I have a function that takes a string and a list, and returns a function that toggles the string in/out of the list. So if the function gets called twice, the string will not appear in the list, but calling it once, the string will be in the list.</p>
  
  <p>Is there some standard convention (like callback/handler) for a function that generates another function? I'm working with JavaScript.</p>
  
  <p>Thanks.</p>
  
  <p>Code below:</p>
  
  <pre><code>function wrappedToggleGenerator(id, list) {
      return function (flag) {
          if (flag) {
              // Clear the list if flag is true
              list.splice(0, list.length);
          }
          if (list.indexOf(id) == -1) {
              list.push(id);
          }
          else if (list.indexOf(id) != -1) {
              list.splice(list.indexOf(id), 1);
          }
      }
  }
  </code></pre>
  
  <p>EDIT: I have added my code. Thanks for the suggestions, I think I will prefix function generators with "wrapped".</p>