(rest)
| 441 | expressions, or $$ for the most recently printed expression.`; |
| 442 | |
| 443 | function keysCommand(rest) { |
| 444 | if (!rest) { |
| 445 | print("Missing argument. See 'help keys'"); |
| 446 | return; |
| 447 | } |
| 448 | |
| 449 | const result = evalInFrame(rest); |
| 450 | if (!result) |
| 451 | return; |
| 452 | |
| 453 | const dv = result.value; |
| 454 | if (!(dv instanceof Debugger.Object)) { |
| 455 | print(`${rest} is ${dvToString(dv)}, not an object`); |
| 456 | return; |
| 457 | } |
| 458 | const names = dv.getOwnPropertyNames(); |
| 459 | const symbols = dv.getOwnPropertySymbols(); |
| 460 | const privateFields = dv.getOwnPrivateProperties(); |
| 461 | const keys = [ |
| 462 | ...names.map(s => `"${s}"`), |
| 463 | ...symbols.map(s => `Symbol("${s.description}")`), |
| 464 | ...privateFields.map(s => `${s.description}`), |
| 465 | ]; |
| 466 | if (keys.length === 0) |
| 467 | print('No own properties'); |
| 468 | else |
| 469 | print(keys.join(', ')); |
| 470 | } |
| 471 | keysCommand.summary = 'Prints own properties of the given object'; |
| 472 | keysCommand.helpText = `USAGE |
| 473 | keys <obj> |
nothing calls this directly
no test coverage detected