src/React/Widgets/SelectionEditorWidget/rule/index.js
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]);
  }
}
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]);
  }
}
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 ] ) ; } }
Edit in place
Edit in place