I am using coffeescript with grunt and am trying to only include JS files file pattern "*.min.js". Somehow my test is failing though and all files get included. So my if statement always returns true. How do I make this work?
getJsDependencies = ->
js_dependencies_path = path.join __dirname, "js", "dep"
paths = []
for js_file in fs.readdirSync(js_dependencies_path)
file_path = path.join __dirname, "js", "dep", js_file
console.log js_file
if js_file.indexOf ".min.js", 0 > 0
paths.push file_path
paths
I tried all kinds of combinations of js_file.indexOf but I am not having any luck with having only .min.js files included. In fact, I want to exclude them but I am stuck with string matching not the logic.
Help is appreciated!