(id)
| 113 | * JSON.stringify - for the object form - but ensuring keys are sorted |
| 114 | */ |
| 115 | export function stringifyId(id) { |
| 116 | if (typeof id !== 'object') { |
| 117 | return id; |
| 118 | } |
| 119 | const stringifyVal = v => (v && v.wild) || JSON.stringify(v); |
| 120 | const parts = Object.keys(id) |
| 121 | .sort() |
| 122 | .map(k => JSON.stringify(k) + ':' + stringifyVal(id[k])); |
| 123 | return '{' + parts.join(',') + '}'; |
| 124 | } |
| 125 | |
| 126 | /* |
| 127 | * id dict values can be numbers, strings, and booleans. |
no test coverage detected
searching dependent graphs…