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:
822 bytes
|
Rev | Line | |
---|
[d24f17c] | 1 | import { type, identical, pipe, curryN } from 'ramda';
|
---|
| 2 |
|
---|
| 3 | /**
|
---|
| 4 | * Checks if input value is `Generator Function`.
|
---|
| 5 | *
|
---|
| 6 | * @func isGeneratorFunction
|
---|
| 7 | * @memberOf RA
|
---|
| 8 | * @since {@link https://char0n.github.io/ramda-adjunct/0.5.0|v0.5.0}
|
---|
| 9 | * @category Type
|
---|
| 10 | * @sig * -> Boolean
|
---|
| 11 | * @param {*} val The value to test
|
---|
| 12 | * @return {boolean}
|
---|
| 13 | * @see {@link RA.isFunction|isFunction}, {@link RA.isAsyncFunction|isAsyncFunction}, {@link RA.isNotGeneratorFunction|isNotGeneratorFunction}
|
---|
| 14 | * @example
|
---|
| 15 | *
|
---|
| 16 | * RA.isGeneratorFunction(function* test() { }); //=> true
|
---|
| 17 | * RA.isGeneratorFunction(null); //=> false
|
---|
| 18 | * RA.isGeneratorFunction(function test() { }); //=> false
|
---|
| 19 | * RA.isGeneratorFunction(() => {}); //=> false
|
---|
| 20 | */
|
---|
| 21 | const isGeneratorFunction = curryN(
|
---|
| 22 | 1,
|
---|
| 23 | pipe(type, identical('GeneratorFunction'))
|
---|
| 24 | );
|
---|
| 25 |
|
---|
| 26 | export default isGeneratorFunction;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.