Skip to content

Commit b0407d7

Browse files
authored
Merge pull request #192 from netlify/refactoring/reduce-to-some
Small code simplification (`Array.reduce()` -> `Array.some()`)
2 parents a82873b + aede228 commit b0407d7

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

Diff for: lib/build.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,12 @@ function haveBabelrc(functionsDir) {
2020

2121
return (
2222
fs.existsSync(path.join(cwd, ".babelrc")) ||
23-
functionsDir.split("/").reduce((foundBabelrc, dir) => {
24-
if (foundBabelrc) return foundBabelrc;
25-
23+
functionsDir.split("/").some(dir => {
2624
const indexOf = functionsDir.indexOf(dir);
2725
const dirToSearch = functionsDir.substr(0, indexOf);
2826

2927
return fs.existsSync(path.join(cwd, dirToSearch, ".babelrc"));
30-
}, false)
28+
})
3129
);
3230
}
3331

0 commit comments

Comments
 (0)