Created
September 17, 2017 17:49
-
-
Save autioch/7c96d2f948e8fee3a3db983a9252d229 to your computer and use it in GitHub Desktop.
Stringify function
This file contains hidden or 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
module.exports = function stringifyFunction(obj) { | |
return JSON.stringify(obj, (key, value) => { | |
if (typeof value === 'function') { | |
return `[Function ${value.name}]`; | |
} | |
return value; | |
}, ' '); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment