title: Does anyone know of a JS Chaining library that allows for deferred execution of methods?
body: <p>I'm looking for a library that allows me to easily chain together methods but defer their execution until arguments are provided further along in the chain:</p>
  
  <pre><code>chain
      .scanDirectory  ( '/path/to/scan' )
          .recursively()
          .for        ( /\.js$/i        )
      .cache()
      .provideTo      ( '0.locals'      )
          .as         ( 'scripts'       )
      .defer();
  </code></pre>
  
  <p>The important thing is that the code behind the <code>scanDirectory</code> function isn't actually called until it's defined that it should be recursive and looking for <code>.js</code> files.</p>
  
  <p>I'm not quite sure how to logically set this up so that I can do something like:</p>
  
  <pre><code>chain
      .scanDirectory( '/path/to/scan' )
      .scanDirectory( '/another/path' )
          .for      ( /\.js$/i        ) // provided to both paths above?
      .doSomethingElse()
  </code></pre>
  
  <p>which is why I'm looking for a library that may have more mature ideas that accomplish this :)</p>