motion-master-client 0.0.56 → 0.0.57

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "motion-master-client",
3
- "version": "0.0.56",
3
+ "version": "0.0.57",
4
4
  "type": "commonjs",
5
5
  "description": "A library and CLI program used for communicating with Motion Master."
6
6
  }
@@ -168,3 +168,21 @@ export function intersectionParametersWithDifferentValues<T extends Pick<Paramet
168
168
  return false;
169
169
  });
170
170
  }
171
+
172
+ export interface ParametersComparison<T extends Pick<Parameter, 'index' | 'subindex' | 'value'>, V = T & { valueOther: ParameterValueType }> {
173
+ differences: [T[], T[]];
174
+ intersections: [T[], T[]];
175
+ comparisons: V[],
176
+ }
177
+
178
+ export function compareParameters<T extends Pick<Parameter, 'index' | 'subindex' | 'value'>>(p1: T[], p2: T[], roundFloats = false): ParametersComparison<T> {
179
+ const d1 = differenceParameters(p1, p2);
180
+ const d2 = differenceParameters(p2, p1);
181
+
182
+ const i1 = intersectionParametersWithDifferentValues(p1, p2, roundFloats);
183
+ const i2 = intersectionParametersWithDifferentValues(p2, p1, roundFloats);
184
+
185
+ const comparisons = i1.map((p, index) => ({ ...p, valueOther: i2[index].value }));
186
+
187
+ return { differences: [d1, d2], intersections: [i1, i2], comparisons };
188
+ }