sinon stub an array object
<p>Having read the official documentation and searched, but I still have no idea about this.</p>

<p>Simple Source Code:</p>

<pre><code>// obj is an object with an array element
// each element in array has its function
if (obj.arr['key1']) {
    return obj.arr['key1'].getValue();
}
</code></pre>

<p>What I want is controlling <code>obj.arr</code>, for example:</p>

<pre><code>var stub = sinon.stub(obj, "arr");
stub['key2'].returns = {...} //add new Index 
delete stub['key1'].returns //remove old Index
</code></pre>