({
causedBy,
owner,
owned,
sources,
prev,
value,
}: Readonly<ComputationState>)
| 119 | } |
| 120 | |
| 121 | export const logComputationDetails = ({ |
| 122 | causedBy, |
| 123 | owner, |
| 124 | owned, |
| 125 | sources, |
| 126 | prev, |
| 127 | value, |
| 128 | }: Readonly<ComputationState>): void => { |
| 129 | // Owner |
| 130 | if (owner !== UNUSED) { |
| 131 | const label = inGray('Owner:') |
| 132 | if (!owner) console.log(label, null) |
| 133 | else { |
| 134 | const {name} = getNodeState(owner) |
| 135 | console.log(`${label} %c${name}`, STYLES.grayBackground) |
| 136 | } |
| 137 | } |
| 138 | |
| 139 | // Value |
| 140 | if (value !== UNUSED) console.log(`${inGray('Value =')}${getValueSpecifier(value)}`, value) |
| 141 | if (prev !== UNUSED) logPrevValue(prev) |
| 142 | |
| 143 | // Caused By |
| 144 | if (causedBy && causedBy.length) { |
| 145 | if (causedBy.length === 1) { |
| 146 | const cause = causedBy[0]! |
| 147 | console.log( |
| 148 | `%c${inGray('Caused By:')} %c${cause.name}%c ${inGray('=')}`, |
| 149 | '', |
| 150 | getNameStyle(cause.type), |
| 151 | '', |
| 152 | cause.value, |
| 153 | ) |
| 154 | } else { |
| 155 | console.groupCollapsed(inGray('Caused By:'), causedBy.length) |
| 156 | causedBy.forEach(cause => { |
| 157 | console.log( |
| 158 | `%c${cause.name}%c ${inGray('=')}`, |
| 159 | getNameStyle(cause.type), |
| 160 | '', |
| 161 | cause.value, |
| 162 | ) |
| 163 | }) |
| 164 | console.groupEnd() |
| 165 | } |
| 166 | } |
| 167 | |
| 168 | // Sources |
| 169 | if (sources.length) { |
| 170 | console.groupCollapsed(inGray('Sources:'), sources.length) |
| 171 | sources.forEach(source => { |
| 172 | const {type, name} = getNodeState(source) |
| 173 | console.log(`%c${name}%c ${inGray('=')}`, getNameStyle(type), '', source.value) |
| 174 | }) |
| 175 | console.groupEnd() |
| 176 | } else { |
| 177 | console.log(inGray('Sources:'), 0) |
| 178 | } |
no test coverage detected
searching dependent graphs…