-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Lexus Drumgold <[email protected]>
- Loading branch information
1 parent
2f6588c
commit 6219e77
Showing
4 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** | ||
* @file Type Tests - isFunction | ||
* @module tutils/guards/tests/unit-d/isFunction | ||
*/ | ||
|
||
import type { Fn } from '#src/types' | ||
import type testSubject from '../is-function' | ||
|
||
describe('unit-d:guards/isFunction', () => { | ||
it('should guard Fn', () => { | ||
expectTypeOf<typeof testSubject>().guards.toEqualTypeOf<Fn>() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/** | ||
* @file Unit Tests - isFunction | ||
* @module tutils/guards/tests/unit/isFunction | ||
*/ | ||
|
||
import testSubject from '../is-function' | ||
|
||
describe('unit:guards/isFunction', () => { | ||
it('should return false if value is not a function', () => { | ||
expect(testSubject(faker.datatype.boolean())).to.be.false | ||
}) | ||
|
||
it('should return true if value is a function', () => { | ||
expect(testSubject(vi.fn())).to.be.true | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/** | ||
* @file Type Guards - isFunction | ||
* @module tutils/guards/isFunction | ||
*/ | ||
|
||
import type { Fn } from '#src/types' | ||
|
||
/** | ||
* Checks if the given `value` is a function. | ||
* | ||
* @param {unknown} value - Value to evaluate | ||
* @return {value is Fn} `true` if `value` is a function | ||
*/ | ||
const isFunction = (value: unknown): value is Fn => typeof value === 'function' | ||
|
||
export default isFunction |