is-error.js 535 B

123456789101112131415161718
  1. "use strict";
  2. module.exports = function (t, a) {
  3. a(t(), false, "Undefined");
  4. a(t(1), false, "Primitive");
  5. a(t({}), false, "Objectt");
  6. a(t({ toString: function () {
  7. return "[object Error]";
  8. } }), false,
  9. "Fake error");
  10. a(t(new Error()), true, "Error");
  11. a(t(new EvalError()), true, "EvalError");
  12. a(t(new RangeError()), true, "RangeError");
  13. a(t(new ReferenceError()), true, "ReferenceError");
  14. a(t(new SyntaxError()), true, "SyntaxError");
  15. a(t(new TypeError()), true, "TypeError");
  16. a(t(new URIError()), true, "URIError");
  17. };