How it works. You put development-only code into comments and start those comments with tags that indicate what the code is for. For example:
Development time. You use JSDev to produce the development-time variant of the code. Quoting Crockford:
You give it a list of the tags you want activated. It reads stdin, looking for those tags, and produces on stdout the activated development-mode program.In the above case, you would execute the following Unix command:
cat src/account.js | JSDev testable > srcdev/account.jsDeployment time. Any minification you apply to the code will remove the JSDev comments and thus prevent that the development-only code wastes space.
Other uses. Obviously this technique has other uses, for any kind of development-only code: logging, performance tracking, etc.