Created
October 20, 2017 14:56
-
-
Save MrHen/c33bac4579330268168fd0a2ddcbfdfc to your computer and use it in GitHub Desktop.
Unerror
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function unerror (value) { | |
if (value instanceof Error) { | |
var error = {} | |
Object.getOwnPropertyNames(value).forEach(function (key) { | |
error[key] = value[key] | |
}) | |
return error | |
} | |
return value | |
} | |
module.exports = unerror |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment