Last active
August 29, 2015 14:02
-
-
Save ralt/d1e07c3c77813383734b to your computer and use it in GitHub Desktop.
cpp preprocessor for JS source
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
/* | |
$ cpp -P -nostdinc test.js bundle.js | |
# OR | |
$ cpp -P -nostdinc test.js | |
# To give parameters, use -D, like this: | |
$ cpp -P -nostdinc -D DEV test.js | |
# For source code like this: | |
*/ | |
#if defined DEV | |
#define ASSERT(x) console.assert(x) | |
#else | |
#define ASSERT(x) | |
#endif | |
#define SOME_CONST 5 | |
var Promise = require('bluebird'); | |
ASSERT(1 === 1); | |
Promise.cast([1, 2, 3, SOME_CONST]).reduce(function(_, i) { | |
console.log('Launching ' + i); | |
return Promise.delay(Math.floor(Math.random() * 1000)).then(function() { | |
console.log('Executing ' + i); | |
}); | |
}, 0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment