|
1 |
| -mixin jsprimitive(value, _type) |
2 |
| - if _type === 'Date' |
3 |
| - - value = moment(value).format('LLL') |
4 |
| - .document-property-value(title=value)= value |
| 1 | +mixin jsvalue(value, _type) |
| 2 | + if _type === 'Array' |
| 3 | + - value = 'Array[' + value.length + ']' |
| 4 | + .document-property-type-label= value |
| 5 | + else if _type === 'Object' |
| 6 | + - value = 'Object' |
| 7 | + .document-property-type-label= value |
| 8 | + else |
| 9 | + if _type === 'Date' |
| 10 | + - value = moment(value).format('LLL') |
| 11 | + .document-property-value(title=value)= value |
5 | 12 |
|
6 | 13 | mixin jsarray(items)
|
7 | 14 | ol.document-property-body
|
8 | 15 | each item in items
|
9 | 16 | +jsproperty(null, item)
|
10 |
| - |
| 17 | + |
11 | 18 | mixin jsproperty(key, value)
|
12 | 19 | - _type = getType(value)
|
13 |
| - - is_expandable = _type === 'Object' || _type === 'Array' |
14 |
| - if !is_expandable |
15 |
| - if key |
16 |
| - li.document-property |
17 |
| - .document-property-key= key |
18 |
| - +jsprimitive(value, _type) |
19 |
| - else |
20 |
| - li.document-property-array-item |
21 |
| - +jsprimitive(value, _type) |
22 |
| - else if _type === 'Array' |
23 |
| - li.document-property-array |
24 |
| - .document-property-header |
| 20 | + li(class='document-property #{_type.toLowerCase()}') |
| 21 | + .document-property-header |
| 22 | + if _type === 'Array' || _type === 'Object' |
25 | 23 | .caret
|
26 |
| - if key |
27 |
| - .document-property-key= key |
28 |
| - | : |
29 |
| - .document-property-type-label Array[#{value.length}] |
| 24 | + if key |
| 25 | + .document-property-key= key |
| 26 | + |: |
| 27 | + +jsvalue(value, _type) |
| 28 | + if _type === 'Array' |
30 | 29 | +jsarray(value)
|
31 |
| - else |
32 |
| - li.document-property-object |
33 |
| - .document-property-header |
34 |
| - .caret |
35 |
| - if key |
36 |
| - .document-property-key= key |
37 |
| - | : |
38 |
| - .document-property-type-label Object |
| 30 | + if _type === 'Object' |
39 | 31 | +jsobject(value)
|
40 | 32 |
|
41 |
| - |
42 | 33 | mixin jsobject(obj)
|
43 | 34 | ol.document-property-body
|
44 | 35 | for value, key in obj
|
|
0 commit comments