Normalises a collection value
All 14 scenarios hold
Inside a cell, the formatter rewrites a list, a set, and a map. It writes one space after each comma and each colon. It writes no space directly inside a bracket. It does the same through a nested collection. A quoted key keeps its quotes.
expected outcome
broken scenario
| Scenario | Value | Formatted? |
|---|---|---|
| A list | [1,2,3] | [1, 2, 3] |
| A map | [a:1,b:2] | [a: 1, b: 2] |
| A set | {1,2,3} | {1, 2, 3} |
| An empty list | [] | [] |
| An empty map | [:] | [:] |
| An empty set | {} | {} |
| Spaces just inside the brackets | [ [] ] | [[]] |
| A single-quoted key | ['[a]':1,'b:b':2] | ['[a]': 1, 'b:b': 2] |
| A double-quoted key | [",a,":1,"b|b":2] | [",a,": 1, "b|b": 2] |
| A list inside a list | [[1,2],[3,4]] | [[1, 2], [3, 4]] |
| A list inside a set | {[1,2]} | {[1, 2]} |
| A map inside a list | [[a:1],[b:2]] | [[a: 1], [b: 2]] |
| A list inside a map | [a:[1,2],b:[3,4]] | [a: [1, 2], b: [3, 4]] |
| Three levels of nesting | [a:{[1,2]},b:{[3,4]}] | [a: {[1, 2]}, b: {[3, 4]}] |