main
Last change
on this file since d24f17c was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
660 bytes
|
Rev | Line | |
---|
[d24f17c] | 1 | import { type, identical, pipe, curryN } from 'ramda';
|
---|
| 2 |
|
---|
| 3 | /**
|
---|
| 4 | * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`, `SyntaxError`, `TypeError` or `URIError` object.
|
---|
| 5 | *
|
---|
| 6 | * @func isError
|
---|
| 7 | * @category Type
|
---|
| 8 | * @memberOf RA
|
---|
| 9 | * @since {@link https://char0n.github.io/ramda-adjunct/2.30.0|v2.30.0}
|
---|
| 10 | * @sig * -> Boolean
|
---|
| 11 | * @param {*} val The value to test
|
---|
| 12 | * @return {boolean} Returns `true` if value is an error object, `false` otherwise
|
---|
| 13 | * @example
|
---|
| 14 | *
|
---|
| 15 | * RA.isError(new Error()); //=> true
|
---|
| 16 | * RA.isError(Error); //=> false
|
---|
| 17 | * RA.isError(1); // => false
|
---|
| 18 | */
|
---|
| 19 | const isError = curryN(1, pipe(type, identical('Error')));
|
---|
| 20 |
|
---|
| 21 | export default isError;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.