-
Notifications
You must be signed in to change notification settings - Fork 0
isGenerator
Subhajit Sahu edited this page Jul 22, 2022
·
2 revisions
Check if value is a generator function.
Similar: [is], [isAsync], isGenerator.
function isGenerator(v)
// v: a valueconst {isGenerator} = require('extra-function');
function* naturalNumbers() {
for (var i=0;; ++i)
yield i;
}
isGenerator(naturalNumbers);
// → true
isGenerator(() => 0);
// → false