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);
@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