-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
34 lines (23 loc) · 814 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
'use strict';
const formatters = require('./src/formatter');
let isInstalled = false;
module.exports = {install};
function install () {
if (typeof window === undefined || isInstalled === true) {return;}
window.devtoolsFormatters = window.devtoolsFormatters || [];
window.devtoolsFormatters.push({
header(obj) {
if (!(obj && obj.toJS)) return;
if (obj.__IS_NESTED__) return formatters.formatHeaderAsTitle(obj.value);
if (obj.size >= 100) return formatters.formatHeaderAsSummary(obj.slice(0, 99));
return formatters.formatHeaderInFull(obj);
},
hasBody(obj) {
return obj && obj.toJS && (obj.size >= 100 || obj.__IS_NESTED__);
},
body(obj) {
return formatters.formatBody(obj.__IS_NESTED__ ? obj.value : obj);
}
});
isInstalled = true;
}