title: how to make this code more functional and readable?
body: <p>How to make those javascript statements to look more readable. Could functional library ramda.js be used to make this code look better?     </p>
  
  <pre><code>var getTextSpace =  function(len)
      {
              var tlength;
              if (len &gt;= 1 &amp;&amp; len &lt;= 4) {
                  tlength = 10;
              } else if (len === 5) {
                  tlength = 14;
              } else if (len === 6) {
                  tlength = 16;
              } else if (len === 7) {
                  tlength = 18;
              } else if (len &gt;= 8 &amp;&amp; len &lt;= 10) {
                  tlength = 20;
              } else if (len === 11) {
                  tlength = 22;
              } else if (len === 12) {
                  tlength = 24;
              } else if (len &gt;= 13 &amp;&amp; len &lt;= 15) {
                  tlength = 26;
              } else if (len === 16) {
                  tlength = 28;
              } else if (len &gt;= 17 &amp;&amp; len &lt;= 20) {
                  tlength = 32;
              } else if (len &gt;= 21 &amp;&amp; len &lt;= 34) {
                  tlength = tlength * 2;
              } else if (len &gt;= 35 &amp;&amp; len &lt;= 80) {
                  tlength = Math.round((len + len / 100 * 50));
              }
              else {
                  tlength = Math.round((len + len / 100 * 30));
              }
          return tlength;
      };
  </code></pre>
  
  <p>Thank you in advance.</p>
  
  <p>Maybe it is possible to do something that will allow this ? </p>
  
  <pre><code>   value
       .between(2,20).then(20)
       .between(21,22).then(0)
       .greater(25).then(25))
       .less(30).then(function(value) {return value * 20 )})
  </code></pre>