source: imaps-frontend/node_modules/lodash-es/isError.js@ d565449

main
Last change on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 959 bytes
Line 
1import baseGetTag from './_baseGetTag.js';
2import isObjectLike from './isObjectLike.js';
3import isPlainObject from './isPlainObject.js';
4
5/** `Object#toString` result references. */
6var domExcTag = '[object DOMException]',
7 errorTag = '[object Error]';
8
9/**
10 * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
11 * `SyntaxError`, `TypeError`, or `URIError` object.
12 *
13 * @static
14 * @memberOf _
15 * @since 3.0.0
16 * @category Lang
17 * @param {*} value The value to check.
18 * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
19 * @example
20 *
21 * _.isError(new Error);
22 * // => true
23 *
24 * _.isError(Error);
25 * // => false
26 */
27function isError(value) {
28 if (!isObjectLike(value)) {
29 return false;
30 }
31 var tag = baseGetTag(value);
32 return tag == errorTag || tag == domExcTag ||
33 (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
34}
35
36export default isError;
Note: See TracBrowser for help on using the repository browser.