title: javascript how to write a function that handles dynamic method chaining
body: <p>So lets say I have the following method</p>
  
  <pre><code>api.post('users')
          .set(key,value);
          .send(data)
          .expect(201)
  </code></pre>
  
  <p>I was curious in javascript how I could set up a function to dynamically call/chain .set on the first method based on the number of keys in an object? So if I had the object <code>foo = {a: 1, b:2 , c:2}</code></p>
  
  <p>the function would behave like the following</p>
  
  <pre><code> api.post('users')
              .set(a,1)
              .set(b,2)
              .set(c,3)
              .send(data)
              .expect(201)
  </code></pre>