Add is.asyncFunction (#20)

This commit is contained in:
Brandon Smith 2017-10-15 23:29:10 -04:00 committed by Sindre Sorhus
parent 04cb80dfb1
commit dc3b6ff86b
3 changed files with 27 additions and 2 deletions

12
test.js
View file

@ -68,6 +68,10 @@ const types = new Map([
['generatorFunction', function * () {
yield 4;
}],
['asyncFunction', [
async function () {},
async () => {}
]],
['map', new Map()],
['set', new Set()],
['weakMap', new WeakMap()],
@ -172,7 +176,7 @@ test('is.array', t => {
});
test('is.function', t => {
testType(t, 'function', ['generatorFunction']);
testType(t, 'function', ['generatorFunction', 'asyncFunction']);
});
test('is.buffer', t => {
@ -215,6 +219,12 @@ test('is.generatorFunction', t => {
testType(t, 'generatorFunction', ['function']);
});
if (isNode8orHigher) {
test('is.asyncFunction', t => {
testType(t, 'asyncFunction', ['function']);
});
}
test('is.map', t => {
testType(t, 'map');
});