(result)
| 202 | |
| 203 | // Format CDP RemoteObject values into more readable formats. |
| 204 | function formatRemoteObject(result) { |
| 205 | if (result === undefined) { return 'undefined'; } |
| 206 | |
| 207 | switch (result.type) { |
| 208 | case 'undefined': |
| 209 | return 'undefined'; |
| 210 | case 'string': |
| 211 | return JSONStringify(result.value); |
| 212 | case 'number': |
| 213 | if (result.unserializableValue !== undefined) { |
| 214 | return result.unserializableValue; |
| 215 | } |
| 216 | return `${result.value}`; |
| 217 | case 'boolean': |
| 218 | return `${result.value}`; |
| 219 | case 'symbol': |
| 220 | return result.description || 'Symbol()'; |
| 221 | case 'bigint': |
| 222 | return result.unserializableValue ?? result.description ?? '0n'; |
| 223 | case 'function': |
| 224 | return result.description || 'function()'; |
| 225 | case 'object': |
| 226 | if (result.subtype === 'null') { |
| 227 | return 'null'; |
| 228 | } |
| 229 | if (result.subtype === 'error') { |
| 230 | return result.description || 'Error'; |
| 231 | } |
| 232 | if (result.preview !== undefined) { |
| 233 | const properties = ArrayPrototypeJoin(ArrayPrototypeMap( |
| 234 | result.preview.properties, |
| 235 | result.preview.subtype === 'array' ? |
| 236 | (property) => formatPreviewPropertyValue(property) : |
| 237 | (property) => `${property.name}: ${formatPreviewPropertyValue(property)}`, |
| 238 | ), ', '); |
| 239 | const suffix = result.preview.overflow ? ', ...' : ''; |
| 240 | if (result.preview.subtype === 'array') { |
| 241 | return `[${properties}${suffix}]`; |
| 242 | } |
| 243 | return `{${properties}${suffix}}`; |
| 244 | } |
| 245 | return result.description || result.className || 'Object'; |
| 246 | default: |
| 247 | return `${result.value ?? result.description ?? ''}`; |
| 248 | } |
| 249 | } |
| 250 | |
| 251 | function formatHitLocation(location) { |
| 252 | return `${location.url}:${location.line}:${location.column}`; |
no test coverage detected
searching dependent graphs…