How to match an array of objects with sinon.js?
<p>How can I match an array of results in a sinon matcher?</p>

<p>For example, how can this code work?</p>

<pre><code>var mystub = sinon.stub();
var myarg = { val: 1, mylist: [ {a:1}, {b:2}, {c:3,d:4} ] };

mystub(myarg);

sinon.assert.calledOnce(mystub).withArgs(
  sinon.match({val: 1, mylist: [{a:1},{b:2},{c:3,d:4}]}) // this doesn't work
);
</code></pre>

<p>How can I get this to work? (Note that in my test, I don't have access to myarg - so I need to match it).</p>

<p>Obviously, I could write a custom function matcher, but I'm looking for something a bit easier to read and write.</p>