Pre-processing in JavaScript