* Receives an index description and returns a modified index description which has had invalid options removed * from the description and has mapped the `version` option to the `v` option.
( description: IndexDescription )
| 202 | * from the description and has mapped the `version` option to the `v` option. |
| 203 | */ |
| 204 | function resolveIndexDescription( |
| 205 | description: IndexDescription |
| 206 | ): Omit<ResolvedIndexDescription, 'key'> { |
| 207 | const validProvidedOptions = Object.entries(description).filter(([optionName]) => |
| 208 | VALID_INDEX_OPTIONS.has(optionName) |
| 209 | ); |
| 210 | |
| 211 | return Object.fromEntries( |
| 212 | // we support the `version` option, but the `createIndexes` command expects it to be the `v` |
| 213 | validProvidedOptions.map(([name, value]) => (name === 'version' ? ['v', value] : [name, value])) |
| 214 | ); |
| 215 | } |
| 216 | |
| 217 | /** |
| 218 | * @public |
no test coverage detected