( workspace: WorkspaceDefinition, host: WorkspaceHost, path?: string, format?: WorkspaceFormat, )
| 130 | * @return An `Promise` of type `void`. |
| 131 | */ |
| 132 | export async function writeWorkspace( |
| 133 | workspace: WorkspaceDefinition, |
| 134 | host: WorkspaceHost, |
| 135 | path?: string, |
| 136 | format?: WorkspaceFormat, |
| 137 | ): Promise<void> { |
| 138 | if (format === undefined) { |
| 139 | format = formatLookup.get(workspace); |
| 140 | if (format === undefined) { |
| 141 | throw new Error('A format is required for custom workspace objects.'); |
| 142 | } |
| 143 | } |
| 144 | |
| 145 | switch (format) { |
| 146 | case WorkspaceFormat.JSON: |
| 147 | return writeJsonWorkspace(workspace, host, path); |
| 148 | default: |
| 149 | throw new Error('Unsupported workspace format.'); |
| 150 | } |
| 151 | } |
no test coverage detected