Go back to using or check instead of pattern

This commit is contained in:
Kevin Sawicki
2015-02-20 15:11:46 -08:00
parent caff9e0866
commit 7ca9e5614c

View File

@@ -132,8 +132,10 @@ transpile = (sourceCode, filePath, cachePath) ->
# either generated on the fly or pulled from cache.
loadFile = (module, filePath) ->
sourceCode = fs.readFileSync(filePath, 'utf8')
unless /^("use 6to5"|'use 6to5'|"use babel"|'use babel')/.test(sourceCode)
return module._compile(sourceCode, filePath)
return module._compile(sourceCode, filePath) unless sourceCode.startsWith('"use 6to5"') or
sourceCode.startsWith("'use 6to5'") or
sourceCode.startsWith('"use babel"') or
sourceCode.startsWith("'use babel'")
cachePath = getCachePath(sourceCode)
js = getCachedJavaScript(cachePath) ? transpile(sourceCode, filePath, cachePath)