Skip to content

Instantly share code, notes, and snippets.

@jsdf
Last active May 19, 2022 10:51
Show Gist options
  • Save jsdf/e27e0e467dc8db3fb1e1 to your computer and use it in GitHub Desktop.
Save jsdf/e27e0e467dc8db3fb1e1 to your computer and use it in GitHub Desktop.
Chrome devtools formatter for Immutable-js
const immutableJSFormatter = {
header(x) {
if (x && x.toJS) return ['span', {}, x.toString()];
return null;
},
hasBody(x) {
return x && x.toJS;
},
body(x) {
return ['span', {}, JSON.stringify(x.toJS(), null, 2)];
},
};
window.devtoolsFormatters = window.devtoolsFormatters || [];
window.devtoolsFormatters.push(immutableJSFormatter);
@jsdf
Copy link
Author

jsdf commented Sep 29, 2015

Note that for this to work you have to be running at least Chrome 47 (currently in Canary as of Sept 2015)

@jsdf
Copy link
Author

jsdf commented Sep 30, 2015

Screenshot:

screen shot 2015-09-30 at 9 59 52 am

@coodoo
Copy link

coodoo commented Oct 7, 2015

Wondering can you make the final output like this instead of strings so that it's easier to read?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment