<h3 dir="auto">Input Code</h3>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="class function_proxy extends Function {
  constructor () {
    super([], &quot;return 1&quot;);
  }
}
let a = new function_proxy();
console.log(a instanceof function_proxy)"><pre class="notranslate"><code class="notranslate">class function_proxy extends Function {
  constructor () {
    super([], "return 1");
  }
}
let a = new function_proxy();
console.log(a instanceof function_proxy)
</code></pre></div>
<h3 dir="auto">Expected Behavior</h3>
<p dir="auto"><code class="notranslate">true</code></p>
<h3 dir="auto">Current Behavior</h3>
<p dir="auto"><code class="notranslate">false</code></p>
<h3 dir="auto">Context</h3>
<p dir="auto">I'm trying to find a way to create an object that can be called but still works with <code class="notranslate">instanceof</code>.</p>
<h3 dir="auto">Your Environment</h3>

<table role="table">
<thead>
<tr>
<th>software</th>
<th>version(s)</th>
</tr>
</thead>
<tbody>
<tr>
<td>Babel</td>
<td>babel-core@6.24.1</td>
</tr>
<tr>
<td>node</td>
<td>v7.9.0</td>
</tr>
<tr>
<td>npm</td>
<td>4.5.0</td>
</tr>
<tr>
<td>Operating System</td>
<td></td>
</tr>
</tbody>
</table>
<p dir="auto">I have tested this input code in chrome and your compiled code also and discovered an issue. I have described that issue in the comments in the following code.</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="class B extends RegExp {
  constructor(source, flags) {
    super(source, flags);
  }
  getName() {
    return 'name';
  }
}

new B('test', 'i').test('TeSt') // is true as should be
new B('test', 'i').test('TeSt') // throws error but should be &quot;name&quot;"><pre class="notranslate"><span class="pl-k">class</span> <span class="pl-v">B</span> <span class="pl-k">extends</span> <span class="pl-v">RegExp</span> <span class="pl-kos">{</span>
  <span class="pl-en">constructor</span><span class="pl-kos">(</span><span class="pl-s1">source</span><span class="pl-kos">,</span> <span class="pl-s1">flags</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-smi">super</span><span class="pl-kos">(</span><span class="pl-s1">source</span><span class="pl-kos">,</span> <span class="pl-s1">flags</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-kos">}</span>
  <span class="pl-en">getName</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-k">return</span> <span class="pl-s">'name'</span><span class="pl-kos">;</span>
  <span class="pl-kos">}</span>
<span class="pl-kos">}</span>

<span class="pl-k">new</span> <span class="pl-v">B</span><span class="pl-kos">(</span><span class="pl-s">'test'</span><span class="pl-kos">,</span> <span class="pl-s">'i'</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">test</span><span class="pl-kos">(</span><span class="pl-s">'TeSt'</span><span class="pl-kos">)</span> <span class="pl-c">// is true as should be</span>
<span class="pl-k">new</span> <span class="pl-v">B</span><span class="pl-kos">(</span><span class="pl-s">'test'</span><span class="pl-kos">,</span> <span class="pl-s">'i'</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">test</span><span class="pl-kos">(</span><span class="pl-s">'TeSt'</span><span class="pl-kos">)</span> <span class="pl-c">// throws error but should be "name"</span></pre></div>