title: Is there a simple Javascript library or script to handle simple logic tests?
body: <p>I've been tasked with making a number of options on our website depend on a pre-requisite of completed tasks.</p>
  
  <p>Right now I store objects with a string prerequisite. Eg:</p>
  
  <pre><code>Task1 = {...};
  Task2 = {preq:'Task1', ...}
  </code></pre>
  
  <p>So I can easily check that Task2 is only available when Task1 is complete.</p>
  
  <p>The problem is that the tasks are becoming more complicated and I need to allow for AND / OR logic. Ideally I'd be able to use an expression such as</p>
  
  <pre><code>Task4 = {prereq:'(Task1&amp;Task2)|Task3}, ...}
  </code></pre>
  
  <p>which would make task4 available if either task 1 and 2 has been completed OR task 3 has been completed.</p>
  
  <p>I'm not really sure about the best way to go about this. I feel that maybe I need a parser or something similar so I'd appreciate a solution or at the very least pointers in the right direction.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Right now, I'm using a system similar to this: <a href="http://jsfiddle.net/jEzaz/" rel="nofollow">http://jsfiddle.net/jEzaz/</a></p>
  
  <p>I want to be able to potentially use a range of AND and OR conditions. Right now, I'm just being asked to allow more than one which is easy enough (eg. completing task1 or task2 means you can now do task3) - but I can see the need for more versatility in the future.</p>
  
  <p>I hope that all makes sense!</p>