Hi Gui

On 03/03/2015 05:41 PM, Guilherme Souza wrote:
Hi all,

I was wondering how one could check if a given function is a generator function, is a cross-realm way:

I'm detecting this with the following piece of code:

  if ((function*(){}).constructor.name == 'GeneratorFunction')) {
    // is generator function
  }

or something like:

  function isGenerator(fn) {
return fn && fn.constructor && fn.constructor.name == 'GeneratorFunction'
  }

Regards
Damian

--
Adfinis SyGroup AG
Damian Senn, Software Engineer

Keltenstrasse 98 | CH-3018 Bern
Tel. 031 550 31 11

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to