Skip to content

Commit

Permalink
Build unexpected for production
Browse files Browse the repository at this point in the history
  • Loading branch information
sunesimonsen committed Mar 7, 2014
1 parent 7a8fd95 commit aa4dafc
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lib/unexpected.es5.js
Expand Up @@ -127,6 +127,10 @@
s.match(/^\/.*\/[gim]{0,3}$/);
},

isError: function (err) {
return typeof err === 'object' && Object.prototype.toString.call(err) === '[object Error]';
},

isDate: function (d) {
if (d instanceof Date) return true;
return false;
Expand Down Expand Up @@ -322,8 +326,13 @@
var getOuterHTML = utils.getOuterHTML;
var isArray = utils.isArray;
var isRegExp = utils.isRegExp;
var isError = utils.isError;
var isDate = utils.isDate;

function formatError(err) {
return '[' + Error.prototype.toString.call(err) + ']';
}

/**
* Inspects an object.
*
Expand Down Expand Up @@ -378,6 +387,10 @@
return stylize('' + value, 'regexp');
}

if (isError(value)) {
return formatError(value);
}

// Look up the keys of the object.
var visible_keys = getKeys(value);
var $keys = showHidden ? Object.getOwnPropertyNames(value) : visible_keys;
Expand Down
13 changes: 13 additions & 0 deletions lib/unexpected.js
Expand Up @@ -556,6 +556,10 @@
s.match(/^\/.*\/[gim]{0,3}$/);
},

isError: function (err) {
return typeof err === 'object' && Object.prototype.toString.call(err) === '[object Error]';
},

isDate: function (d) {
if (d instanceof Date) return true;
return false;
Expand Down Expand Up @@ -751,8 +755,13 @@
var getOuterHTML = utils.getOuterHTML;
var isArray = utils.isArray;
var isRegExp = utils.isRegExp;
var isError = utils.isError;
var isDate = utils.isDate;

function formatError(err) {
return '[' + Error.prototype.toString.call(err) + ']';
}

/**
* Inspects an object.
*
Expand Down Expand Up @@ -807,6 +816,10 @@
return stylize('' + value, 'regexp');
}

if (isError(value)) {
return formatError(value);
}

// Look up the keys of the object.
var visible_keys = getKeys(value);
var $keys = showHidden ? Object.getOwnPropertyNames(value) : visible_keys;
Expand Down

0 comments on commit aa4dafc

Please sign in to comment.