Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

removed conditionals in support/compile.js

Tj Holowaychuk10e474ddd895
diff --git a/support/compile.js b/support/compile.js
index b4fd5fac..65be223d 100644
--- a/support/compile.js
+++ b/support/compile.js
@@ -34,7 +34,7 @@ args.forEach(function(file){
*/
function parse(js) {
- return parseRequires(parseInheritance(parseConditionals(js)));
+ return parseRequires(parseInheritance(js));
}
/**
@@ -59,41 +59,6 @@ function parseInheritance(js) {
});
}
-/**
- * Parse the given `js`, currently supporting:
- *
- * 'if' ['node' | 'browser']
- * 'end'
- *
- */
-
-function parseConditionals(js) {
- var lines = js.split('\n')
- , len = lines.length
- , buffer = true
- , browser = false
- , buf = []
- , line
- , cond;
-
- for (var i = 0; i < len; ++i) {
- line = lines[i];
- if (/^ *\/\/ *if *(node|browser)/gm.exec(line)) {
- cond = RegExp.$1;
- buffer = browser = 'browser' == cond;
- } else if (/^ *\/\/ *end/.test(line)) {
- buffer = true;
- browser = false;
- } else if (browser) {
- buf.push(line.replace(/^( *)\/\//, '$1'));
- } else if (buffer) {
- buf.push(line);
- }
- }
-
- return buf.join('\n');
-}
-
/**
* Compile the files.
*/