main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
981 bytes
|
Rev | Line | |
---|
[d24f17c] | 1 | import { anyPass, type, pipe, identical } from 'ramda';
|
---|
| 2 |
|
---|
| 3 | import isGeneratorFunction from './isGeneratorFunction';
|
---|
| 4 | import isAsyncFunction from './isAsyncFunction';
|
---|
| 5 |
|
---|
| 6 | /**
|
---|
| 7 | * Checks if input value is `Function`.
|
---|
| 8 | *
|
---|
| 9 | * @func isFunction
|
---|
| 10 | * @memberOf RA
|
---|
| 11 | * @since {@link https://char0n.github.io/ramda-adjunct/0.5.0|v0.5.0}
|
---|
| 12 | * @category Type
|
---|
| 13 | * @sig * -> Boolean
|
---|
| 14 | * @param {*} val The value to test
|
---|
| 15 | * @return {boolean}
|
---|
| 16 | * @see {@link RA.isNotFunction|isNotFunction}, {@link RA.isAsyncFunction|isNotAsyncFunction}, {@link RA.isGeneratorFunction|isGeneratorFunction}
|
---|
| 17 | * @example
|
---|
| 18 | *
|
---|
| 19 | * RA.isFunction(function test() { }); //=> true
|
---|
| 20 | * RA.isFunction(function* test() { }); //=> true
|
---|
| 21 | * RA.isFunction(async function test() { }); //=> true
|
---|
| 22 | * RA.isFunction(() => {}); //=> true
|
---|
| 23 | * RA.isFunction(null); //=> false
|
---|
| 24 | * RA.isFunction('abc'); //=> false
|
---|
| 25 | */
|
---|
| 26 | const isFunction = anyPass([
|
---|
| 27 | pipe(type, identical('Function')),
|
---|
| 28 | isGeneratorFunction,
|
---|
| 29 | isAsyncFunction,
|
---|
| 30 | ]);
|
---|
| 31 |
|
---|
| 32 | export default isFunction;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.