code: function toSingleRule(str) {
  
    return str
      // replace modulus with shortcuts
      .replace(/([nivwft]) % (\d+)/g, '$1$2')
      // replace ranges
      .replace(/([nivwft]\d*) (=|\!=) (\d+[.,][.,\d]+)/g, function (match, v, cond, range) {
        // range = 5,8,9 (simple set)
        if (range.indexOf('..') < 0 && range.indexOf(',') >= 0) {
          if (cond === '=') {
            return format('IN([ %s ], %s)', range.split(',').join(', '), v);
          }
          return format('!IN([ %s ], %s)', range.split(',').join(', '), v);
        }
        // range = 0..5 or 0..5,8..20 or 0..5,8
        var conditions = range.split(',').map(function (interval) {
          // simple value
          if (interval.indexOf('..') < 0) {
            return format('%s %s %s', v, cond, interval);
          }
          // range
          var start = interval.split('..')[0],
              end   = interval.split('..')[1];
          if (cond === '=') {
            return format('B(%s, %s, %s)', start, end, v);
          }
          return format('!B(%s, %s, %s)', start, end, v);
        });
  
        var joined;
        if (conditions.length > 1) {
          joined =  '(' + conditions.join(cond === '=' ? ' || ' : ' && ') + ')';
        } else {
          joined = conditions[0];
        }
        return joined;
      })
      .replace(/ = /g, ' === ')
      .replace(/ != /g, ' !== ')
      .replace(/ or /g, ' || ')
      .replace(/ and /g, ' && ');
  }
docs: Create equation for single form rule