(verbose = false)
| 657 | } |
| 658 | |
| 659 | async function formatWatchers(verbose = false) { |
| 660 | if (!watchedExpressions.length) { |
| 661 | return ''; |
| 662 | } |
| 663 | |
| 664 | const inspectValue = (expr) => |
| 665 | PromisePrototypeThen(evalInCurrentContext(expr), undefined, |
| 666 | (error) => `<${error.message}>`); |
| 667 | const lastIndex = watchedExpressions.length - 1; |
| 668 | |
| 669 | const values = await SafePromiseAllReturnArrayLike(watchedExpressions, inspectValue); |
| 670 | const lines = ArrayPrototypeMap(watchedExpressions, (expr, idx) => { |
| 671 | const prefix = `${leftPad(idx, ' ', lastIndex)}: ${expr} =`; |
| 672 | const value = inspect(values[idx]); |
| 673 | if (!StringPrototypeIncludes(value, '\n')) { |
| 674 | return `${prefix} ${value}`; |
| 675 | } |
| 676 | return `${prefix}\n ${StringPrototypeReplaceAll(value, '\n', '\n ')}`; |
| 677 | }); |
| 678 | const valueList = ArrayPrototypeJoin(lines, '\n'); |
| 679 | return verbose ? `Watchers:\n${valueList}\n` : valueList; |
| 680 | } |
| 681 | |
| 682 | function watchers(verbose = false) { |
| 683 | return PromisePrototypeThen(formatWatchers(verbose), print); |
no test coverage detected
searching dependent graphs…