How do I assign a value using = when a setter is passed?
<p>I am write a compatibility layer over a legacy library function whose internal signature looks like —</p>

<pre><code>function legacyLibraryFunction(context) {
  context.foo.bar = "data"
  return context
}
</code></pre>

<p>The new system however, doesn't recommend assigning custom properties directly to <code>context</code> and instead recommends using the <code>context.set()</code> method.</p>

<p>How do I pass <code>context</code> from the new system to the old one so that <code>context.foo="data"</code> ends up called <code>context.set('foo', data)</code> instead?</p>

<p>I'm guessing I can use Object.defineProperty for this, but I don't really understand how.</p>