TypeError: Cannot match against 'undefined' or 'null' : <p><strong>Code</strong></p>

<pre><code>client.createPet(pet, (err, {name, breed, age}) =&gt; {
  if (err) {
    return t.error(err, 'no error')
  }
  t.equal(pet, {name, breed, age}, 'should be equivalent')
})
</code></pre>

<p><strong>Error</strong></p>

<pre><code>client.createPet(pet, (err, {name, breed, age}) =&gt; {
                        ^

TypeError: Cannot match against 'undefined' or 'null'.
</code></pre>

<p>Why am I getting this error? My knowledge of ES6 led me to presume that this error should only arise if the <em>array or object being destructured or its children</em> is <code>undefined</code> or <code>null</code>.</p>

<p>I wasn't aware that function parameters are used as a match. And if they are then why is it only an error if I try to destructure one of them? (that isn't <code>undefined</code> or <code>null</code>).</p>
