source: node_modules/ramda-adjunct/src/isError.js

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: 660 bytes
Line 
1import { 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 */
19const isError = curryN(1, pipe(type, identical('Error')));
20
21export default isError;
Note: See TracBrowser for help on using the repository browser.