UNPKG

1.4 kBMarkdownView Raw
1# Chrome Dev Tools for Immutable-js
2
3The [Immutable](http://facebook.github.io/immutable-js/) library is fantastic, but inspecting immutable collections in Chrome's Dev Tools is awkward. You only see the internal data structure, not the logical contents. For example, when inspecting the contents of an Immutable List, you'd really like to see the items in the list.
4
5The latest Canary version of Chrome (v48 as of writing) has support for custom "formatters". A formatter tells Chrome's Dev Tools how to display values in the Console, Scope list, etc. This means we can display Lists, Maps and other collections, in a much better way.
6
7Essentially, it turns this:
8
9![Before](before.png)
10
11into:
12
13![After](after.png)
14
15This library provides a formatter to do just that.
16
17## Installation
18
19Chrome v47+ (currently this is a Canary build)
20
21In Dev Tools, press F1 to load the Settings. Scroll down to the Console section and tick "Enable custom formatters".
22
23Then, in your project, install via npm:
24
25```
26npm install --save-dev immutable-devtools
27```
28
29And enable with:
30
31```js
32var Immutable = require("immutable");
33
34var install = require("immutable-devtools");
35install(Immutable);
36```
37
38Note: You probably only want this library for debug builds, so perhaps wrap with `if (DEBUG) {...}` or similar.
39
40## Features
41
42The library currently has formatters for: List, Map, Set, Record, OrderedMap & OrderedSet.
43