@@ -14,6 +14,7 @@ import is, {
1414 isAny ,
1515 isArray ,
1616 isArrayOf ,
17+ isAsyncFunction ,
1718 isBigInt ,
1819 isBoolean ,
1920 isFunction ,
@@ -31,6 +32,7 @@ import is, {
3132 isRecordOf ,
3233 isString ,
3334 isSymbol ,
35+ isSyncFunction ,
3436 isTupleOf ,
3537 isUndefined ,
3638 isUniformTupleOf ,
@@ -45,7 +47,8 @@ const examples = {
4547 boolean : [ true , false ] ,
4648 array : [ [ ] , [ 0 , 1 , 2 ] , [ "a" , "b" , "c" ] , [ 0 , "a" , true ] ] ,
4749 record : [ { } , { a : 0 , b : 1 , c : 2 } , { a : "a" , b : "b" , c : "c" } ] ,
48- function : [ function a ( ) { } , ( ) => { } ] ,
50+ syncFunction : [ function a ( ) { } , ( ) => { } ] ,
51+ asyncFunction : [ async function b ( ) { } , async ( ) => { } ] ,
4952 null : [ null ] ,
5053 undefined : [ undefined ] ,
5154 symbol : [ Symbol ( "a" ) , Symbol ( "b" ) , Symbol ( "c" ) ] ,
@@ -121,7 +124,8 @@ Deno.test("isAny", async (t) => {
121124 "boolean" ,
122125 "array" ,
123126 "record" ,
124- "function" ,
127+ "syncFunction" ,
128+ "asyncFunction" ,
125129 "null" ,
126130 "undefined" ,
127131 "symbol" ,
@@ -453,7 +457,21 @@ Deno.test("isObjectOf<T>", async (t) => {
453457} ) ;
454458
455459Deno . test ( "isFunction" , async ( t ) => {
456- await testWithExamples ( t , isFunction , { validExamples : [ "function" ] } ) ;
460+ await testWithExamples ( t , isFunction , {
461+ validExamples : [ "syncFunction" , "asyncFunction" ] ,
462+ } ) ;
463+ } ) ;
464+
465+ Deno . test ( "isSyncFunction" , async ( t ) => {
466+ await testWithExamples ( t , isSyncFunction , {
467+ validExamples : [ "syncFunction" ] ,
468+ } ) ;
469+ } ) ;
470+
471+ Deno . test ( "isAsyncFunction" , async ( t ) => {
472+ await testWithExamples ( t , isAsyncFunction , {
473+ validExamples : [ "asyncFunction" ] ,
474+ } ) ;
457475} ) ;
458476
459477Deno . test ( "isInstanceOf<T>" , async ( t ) => {
@@ -694,7 +712,17 @@ Deno.test("isOptionalOf<T>", async (t) => {
694712 } ) ;
695713 await t . step ( "with isFunction" , async ( t ) => {
696714 await testWithExamples ( t , isOptionalOf ( isFunction ) , {
697- validExamples : [ "function" , "undefined" ] ,
715+ validExamples : [ "syncFunction" , "asyncFunction" , "undefined" ] ,
716+ } ) ;
717+ } ) ;
718+ await t . step ( "with isSyncFunction" , async ( t ) => {
719+ await testWithExamples ( t , isOptionalOf ( isSyncFunction ) , {
720+ validExamples : [ "syncFunction" , "undefined" ] ,
721+ } ) ;
722+ } ) ;
723+ await t . step ( "with isAsyncFunction" , async ( t ) => {
724+ await testWithExamples ( t , isOptionalOf ( isAsyncFunction ) , {
725+ validExamples : [ "asyncFunction" , "undefined" ] ,
698726 } ) ;
699727 } ) ;
700728 await t . step ( "with isNull" , async ( t ) => {
0 commit comments