( value: string, drivers?: ReadonlyArray<ConnectionStringDriver>, )
| 250 | * Supported protocols are inferred from the provided drivers/capabilities. |
| 251 | */ |
| 252 | export function looksLikeConnectionString( |
| 253 | value: string, |
| 254 | drivers?: ReadonlyArray<ConnectionStringDriver>, |
| 255 | ): boolean { |
| 256 | if (!value || !value.trim()) return false; |
| 257 | |
| 258 | const trimmed = value.trim(); |
| 259 | |
| 260 | let url: URL; |
| 261 | try { |
| 262 | url = new URL(trimmed); |
| 263 | } catch { |
| 264 | return false; |
| 265 | } |
| 266 | |
| 267 | const protocol = normalizeProtocol(url.protocol); |
| 268 | const registry = buildProtocolRegistry(drivers); |
| 269 | |
| 270 | return registry.has(protocol); |
| 271 | } |
no test coverage detected