| 202 | } |
| 203 | |
| 204 | function* entriesFromString(value: string): Generator<[string, string]> { |
| 205 | if (value === '') { |
| 206 | return; |
| 207 | } |
| 208 | const keyValuePairs = value.split(','); |
| 209 | for (const keyValue of keyValuePairs) { |
| 210 | const [key, value] = keyValue.split(/:(.*)/); |
| 211 | if (value == null) { |
| 212 | throw new MongoParseError('Cannot have undefined values in key value pairs'); |
| 213 | } |
| 214 | |
| 215 | yield [key, value]; |
| 216 | } |
| 217 | } |
| 218 | |
| 219 | class CaseInsensitiveMap<Value = any> extends Map<string, Value> { |
| 220 | constructor(entries: Array<[string, any]> = []) { |