-
Notifications
You must be signed in to change notification settings - Fork 0
isGenerator
Subhajit Sahu edited this page Aug 7, 2022
·
1 revision
Check if value is a generator function.
Similar: is, isAsync, isGenerator.
function isGenerator(v)
// v: a value
const xasyncfn = require('extra-async-function');
function* naturalNumbers() {
for (var i=0;; ++i)
yield i;
}
xasyncfn.isGenerator(naturalNumbers);
// → true
xasyncfn.isGenerator(() => 0);
// → false