@rulecad/versions 0.1.5 → 0.1.6

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/versions.mjs +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rulecad/versions",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "Semver for physical parts: a change to what other parts fit against is major, so you know when an old print stops fitting.",
5
5
  "type": "module",
6
6
  "exports": {
package/versions.mjs CHANGED
@@ -53,7 +53,7 @@ export function compare(before, after) {
53
53
  const change = (name) => (v(before, name) === v(after, name) ? `${val(before, name).value} → ${val(after, name).value}` : `${v(before, name)} → ${v(after, name)}`);
54
54
  const sorted = (x) => (Array.isArray(x) ? x.map(sorted) : x && typeof x === 'object' ? Object.fromEntries(Object.keys(x).sort().map((k) => [k, sorted(x[k])])) : x); // (the same settings in another order are the same)
55
55
  const vars = (r) => r.object.variables || {};
56
- const same = (a, b) => (typeof a === 'number' && typeof b === 'number' ? Math.abs(a - b) < 1e-9 : a === b); // numbers, or choices
56
+ const same = (a, b) => (typeof a === 'number' && typeof b === 'number' ? Math.abs(a - b) < 1e-9 : Array.isArray(a) && Array.isArray(b) ? a.length === b.length && a.every((x, i) => same(x, b[i])) : a === b); // numbers, choices, or a list rule entry by entry
57
57
 
58
58
  for (const [name, d] of Object.entries(vars(before))) {
59
59
  const now = vars(after)[name];