Skip to content

Instantly share code, notes, and snippets.

@pelonpelon
Created April 28, 2015 17:14
Show Gist options
  • Save pelonpelon/6457214290984428a3fc to your computer and use it in GitHub Desktop.
Save pelonpelon/6457214290984428a3fc to your computer and use it in GitHub Desktop.
stringify.js - view objects as strings in the console
export default ( object, jsonIndent = 2 ) =>
JSON.stringify(
object, ( key, value ) =>
value instanceof Function
? value.toString()
: value,
jsonIndent
)
.replace( /\\n/g, '\n' )
.replace( /\\r/g, '\r' )
.replace( /\\t/g, '\t' )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment