Add is.asyncIterable

This commit is contained in:
Artur 2018-07-08 15:37:27 +03:00
parent f81976aa44
commit 2dbf247fc0
2 changed files with 16 additions and 9 deletions

View file

@ -455,14 +455,6 @@ if (isNode8orHigher) {
});*/
}
if (isNode10orHigher) {
test('is.asyncIterable', t => {
t.true(m.asyncIterable(Object.create({
[Symbol.asyncIterator]: () => {} // tslint:disable-line:no-empty
})));
});
}
test('is.generator', t => {
testType(t, 'generator');
});
@ -612,6 +604,21 @@ test('is.iterable', t => {
t.false(m.iterable({}));
});
if (isNode10orHigher) {
test('is.asyncIterable', t => {
t.true(m.asyncIterable({
[Symbol.asyncIterator]: () => {} // tslint:disable-line:no-empty
}));
t.false(m.asyncIterable(null));
t.false(m.asyncIterable(undefined));
t.false(m.asyncIterable(0));
t.false(m.asyncIterable(NaN));
t.false(m.asyncIterable(Infinity));
t.false(m.asyncIterable({}));
});
}
test('is.class', t => {
class Foo {} // tslint:disable-line
const classDeclarations = [