'use strict';

var objectToString = Object.prototype.toString;
var ERROR_TYPE = '[object Error]';

module.exports = isError;

function isError(err) {
    return objectToString.call(err) === ERROR_TYPE;
}

'use strict';

var objectToString = Object.prototype.toString;
var getPrototypeOf = Object.getPrototypeOf;
var ERROR_TYPE = '[object Error]';

module.exports = isError;

function isError(err) {
    while (err) {
        if (objectToString.call(err) === ERROR_TYPE) {
            return true;
        }
        err = getPrototypeOf(err);
    }
    return false;
}

Fix for all combinations of foreign and inherited
Fix for all combinations of foreign and inherited
