Created
September 10, 2015 07:46
-
-
Save sairion/6cdd96766a2ed880fb97 to your computer and use it in GitHub Desktop.
debugwhen.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function debugIf(condition) { // TODO: multi-args | |
var shouldDebug; | |
if (typeof condition === 'function') { | |
shouldDebug = condition(); | |
} else { | |
shouldDebug = condition; | |
} | |
if (shouldDebug) debugger; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment