Browse Source

Replacing lodash chain with flow (#5755)

Jin Shin 4 years ago
parent
commit
bf354d7c77
1 changed files with 11 additions and 2 deletions
  1. 11
    2
      scripts/test-js.js

+ 11
- 2
scripts/test-js.js View File

@@ -1,5 +1,11 @@
1 1
 const exec = require('shell-utils').exec;
2
-const { includes, chain, split, filter } = require('lodash');
2
+const includes = require('lodash/includes')
3
+const split = require('lodash/split')
4
+const filter = require('lodash/filter')
5
+
6
+const flow = require('lodash/fp/flow')
7
+const map = require('lodash/fp/map')
8
+const join = require('lodash/fp/join')
3 9
 
4 10
 const fix = includes(process.argv, '--fix') ? '--fix' : '';
5 11
 
@@ -14,7 +20,10 @@ const dirs = [
14 20
 run();
15 21
 
16 22
 function run() {
17
-  const paths = chain(dirs).map((d) => d === 'e2e' ? `${d}/**/*.[tj]s` : `${d}/**/*.[tj]sx?`).join(' ').value();
23
+  const paths = flow(
24
+    map((d) => d === 'e2e' ? `${d}/**/*.[tj]s` : `${d}/**/*.[tj]sx?`),
25
+    join(' ')
26
+  )(dirs)
18 27
   exec.execSync(`tslint ${paths} ${fix} --format verbose`);
19 28
   assertAllTsFilesInSrc();
20 29
   exec.execSync(`jest --coverage`);