code: function ensureRuleNumbers(rule) {
    if (!rule || rule.length === 0) {
      return;
    }
  
    const ruleSelector = rule.type;
    if (ruleSelector === 'rule') {
      ensureRuleNumbers(rule.rule);
    }
    if (ruleSelector === 'logical') {
      rule.terms.filter((r, idx) => idx > 0).forEach((r) => ensureRuleNumbers(r));
    }
  
    if (ruleSelector === '5C') {
      const terms = rule.terms;
      terms[0] = Number(terms[0]);
      terms[4] = Number(terms[4]);
    }
  }
docs: Edit in place