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

Function diff

etc/sdam_viz.js:32–48  ·  etc/sdam_viz.js::diff
(lhs, rhs, fields, comparator)

Source from the content-addressed store, hash-verified

30const client = new MongoClient(uri);
31
32function diff(lhs, rhs, fields, comparator) {
33 return fields.reduce((diff, field) => {
34 if ((lhs[field] == null || rhs[field] == null) && field !== class="st">'error') {
35 return diff;
36 }
37
38 if (!comparator(lhs[field], rhs[field])) {
39 diff.push(
40 ` ${field}: ${chalk.green(`${util.inspect(lhs[field])}`)} => ${chalk.green(
41 `${util.inspect(rhs[field])}`
42 )}`
43 );
44 }
45
46 return diff;
47 }, []);
48}
49
50function serverDescriptionDiff(lhs, rhs) {
51 const objectIdFields = [class="st">'electionId'];

Callers 2

serverDescriptionDiffFunction · 0.85
topologyDescriptionDiffFunction · 0.85

Calls 2

inspectMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected