( targets: T[], getEditor: (target: T) => TextEditor, func: (editor: TextEditor, editorTargets: T[]) => Promise<U> )
| 25 | } |
| 26 | |
| 27 | export async function runForEachEditor<T, U>( |
| 28 | targets: T[], |
| 29 | getEditor: (target: T) => TextEditor, |
| 30 | func: (editor: TextEditor, editorTargets: T[]) => Promise<U> |
| 31 | ): Promise<U[]> { |
| 32 | return await Promise.all( |
| 33 | Array.from(groupBy(targets, getEditor), async ([editor, editorTargets]) => |
| 34 | func(editor, editorTargets) |
| 35 | ) |
| 36 | ); |
| 37 | } |
| 38 | |
| 39 | export async function runOnTargetsForEachEditor<T>( |
| 40 | targets: TypedSelection[], |
no test coverage detected