MCPcopy
hub / github.com/mongodb/node-mongodb-native / isDriverInfoEqual

Function isDriverInfoEqual

src/cmap/handshake/client_metadata.ts:12–26  ·  view source on GitHub ↗
(info1: DriverInfo, info2: DriverInfo)

Source from the content-addressed store, hash-verified

10
11/** @internal */
12export function isDriverInfoEqual(info1: DriverInfo, info2: DriverInfo): boolean {
13 /** for equality comparison, we consider "" as unset */
14 const nonEmptyCmp = (s1: string | undefined, s2: string | undefined): boolean => {
15 s1 ||= undefined;
16 s2 ||= undefined;
17
18 return s1 === s2;
19 };
20
21 return (
22 nonEmptyCmp(info1.name, info2.name) &&
23 nonEmptyCmp(info1.platform, info2.platform) &&
24 nonEmptyCmp(info1.version, info2.version)
25 );
26}
27
28/**
29 * @internal

Callers 2

appendMetadataMethod · 0.90

Calls 1

nonEmptyCmpFunction · 0.85

Tested by

no test coverage detected