how to for...in loop in async.waterfall nodejs
<p>I have an object </p>

<pre><code>var object = {
 name : null,
 id : 12,
 sys : [{name:'sys'}],
 info : 'string',
 some : [{name:'some'}],
 end : null
}
</code></pre>

<p>in nodejs I need to find in this object arrays and then stringfy and send to redis. So I search array </p>

<pre><code>for(var key in object){
 if(Array.isArray(object[key])) {
  async.waterfall([
   function(callback) {
    // put finded item to redis, then from redis I need to get the key.
   },
   function(res, body, callback) {
    if(body) {
     object[key] = body // I need to replace array &gt; key.
    }
   }
  ])
 }
}
</code></pre>

<p>But It's async, so in second function <code>object[key]</code> is not the same <code>object[key]</code> in previous function. For example in first function of waterfall I put <code>object[key]</code> = sys into redis, then I wait for the key, and in second function when I get the key <code>object[key]</code> = name. How can I past key to correct object?</p>