Sha256: ca6dbefa9e146e737f93782b1e65e8d57f27bcc766f6bb0fb449309e04e6e1be

Contents?: true

Size: 961 Bytes

Versions: 273

Compression:

Stored size: 961 Bytes

Contents

var baseGetTag = require('./_baseGetTag'),
    isObjectLike = require('./isObjectLike'),
    isPlainObject = require('./isPlainObject');

/** `Object#toString` result references. */
var domExcTag = '[object DOMException]',
    errorTag = '[object Error]';

/**
 * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
 * `SyntaxError`, `TypeError`, or `URIError` object.
 *
 * @static
 * @memberOf _
 * @since 3.0.0
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
 * @example
 *
 * _.isError(new Error);
 * // => true
 *
 * _.isError(Error);
 * // => false
 */
function isError(value) {
  if (!isObjectLike(value)) {
    return false;
  }
  var tag = baseGetTag(value);
  return tag == errorTag || tag == domExcTag ||
    (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
}

module.exports = isError;

Version data entries

273 entries across 271 versions & 29 rubygems

Version Path
appmap-0.68.0 ./node_modules/lodash/isError.js
appmap-0.67.1 ./node_modules/lodash/isError.js
trusty-cms-5.0.3 node_modules/lodash/isError.js
trusty-cms-5.0.2 node_modules/lodash/isError.js
appmap-0.67.0 ./node_modules/lodash/isError.js
disco_app-0.18.4 test/dummy/node_modules/lodash/isError.js
disco_app-0.18.1 test/dummy/node_modules/lodash/isError.js
disco_app-0.12.7.pre.puma.pre.3 test/dummy/node_modules/lodash/isError.js
disco_app-0.14.0 test/dummy/node_modules/lodash/isError.js
disco_app-0.13.6.pre.puma.pre.3 test/dummy/node_modules/lodash/isError.js
appmap-0.66.2 ./node_modules/lodash/isError.js
trusty-cms-5.0.1 node_modules/lodash/isError.js
trusty-cms-4.3.5 node_modules/lodash/isError.js
trusty-cms-5.0.0 node_modules/lodash/isError.js
appmap-0.66.1 ./node_modules/lodash/isError.js
appmap-0.66.0 ./node_modules/lodash/isError.js
appmap-0.65.1 ./node_modules/lodash/isError.js
appmap-0.65.0 ./node_modules/lodash/isError.js
trusty-cms-4.3.4 node_modules/lodash/isError.js
sumomo-0.8.12 data/sumomo/api_modules/node_modules/lodash/isError.js