add support for is.generator & is.generatorFunction
This commit is contained in:
parent
103c5afe6f
commit
7fcd993232
3 changed files with 22 additions and 1 deletions
4
index.js
4
index.js
|
|
@ -81,6 +81,10 @@ is.promise = x => {
|
|||
);
|
||||
};
|
||||
|
||||
is.generator = x => x && typeof x.next === 'function' && typeof x.throw === 'function';
|
||||
|
||||
is.generatorFunction = x => x.constructor.name === 'GeneratorFunction';
|
||||
|
||||
is.regExp = x => getObjectType(x) === 'RegExp';
|
||||
is.date = x => getObjectType(x) === 'Date';
|
||||
is.error = x => getObjectType(x) === 'Error';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue