title: Creating a typescript function that can be a no-op
body: <p>I want to create a <a href="http://blogs.windwardreports.com/davidt/2010/12/one-of-the-most-powerful-debugging-practices.html" rel="nofollow">TRAP function</a> where in debug mode it is the "debugger;" call and in release mode it does nothing, preferably not even a call/return.</p>
  
  <p>I have come up with:</p>
  
  <pre><code>// declare it
  var trap = function () { debugger; }
  
  // ...
  
  // use it
  trap();
  </code></pre>
  
  <p>And then for release mode it's:</p>
  
  <pre><code>var trap = function () { }
  </code></pre>
  
  <p>So, question #1 is, is this the best way to do this?</p>
  
  <p>And question #2 is, is there a way to do an "#if DEBUG , #else, #endif" type of pragmas around it, or do we need to change it by hand when we build for production?</p>