File tree Expand file tree Collapse file tree 1 file changed +44
-44
lines changed Expand file tree Collapse file tree 1 file changed +44
-44
lines changed Original file line number Diff line number Diff line change 1
1
var fs = require ( 'fs' ) ,
2
2
path = require ( 'path' ) ;
3
3
4
- module . exports . walk = function ( dir , opts ) {
5
-
6
- var files = [ ] ;
7
-
8
- if ( ! opts ) {
9
- opts = { } ;
10
- }
11
-
12
- if ( ! opts . match ) {
13
- opts . match = / \. j s $ / ;
14
- }
15
-
16
- if ( ! opts . exception ) {
17
- opts . exception = / \. g i t | \. m i n | n o d e _ m o d u l e s | t e s t | g r u n t f i l e / i;
18
- }
19
-
20
- if ( fs . existsSync ( dir ) && fs . statSync ( dir ) . isDirectory ( ) ) {
21
-
22
- fs . readdirSync ( dir ) . forEach ( function ( file ) {
23
-
24
- var stat ;
25
-
26
- file = path . normalize ( dir + '/' + file ) ;
27
-
28
- stat = fs . statSync ( file ) ;
29
-
30
- if ( stat . isDirectory ( ) && ! file . match ( opts . exception ) ) {
31
-
32
- files = files . concat ( module . exports . walk ( file , opts ) ) ;
33
-
34
- } else if ( stat . isFile ( ) && file . match ( opts . match ) && ! file . match ( opts . exception ) ) {
35
-
36
- files . push ( file ) ;
37
-
38
- }
39
-
40
- } ) ;
41
-
42
- }
43
-
44
- return files ;
45
-
46
- } ;
47
-
48
4
module . exports . formatStringForUID = function ( content ) {
49
5
50
6
content = String ( content ) . toLowerCase ( ) ;
@@ -94,3 +50,47 @@ module.exports.parseData = function (data, file) {
94
50
return data ;
95
51
96
52
} ;
53
+
54
+ module . exports . walk = function ( dir , opts ) {
55
+
56
+ var files = [ ] ;
57
+
58
+ if ( ! opts ) {
59
+ opts = { } ;
60
+ }
61
+
62
+ if ( ! opts . match ) {
63
+ opts . match = / \. j s $ / ;
64
+ }
65
+
66
+ if ( ! opts . exception ) {
67
+ opts . exception = / \. g i t | \. m i n | n o d e _ m o d u l e s | t e s t | g r u n t f i l e / i;
68
+ }
69
+
70
+ if ( fs . existsSync ( dir ) && fs . statSync ( dir ) . isDirectory ( ) ) {
71
+
72
+ fs . readdirSync ( dir ) . forEach ( function ( file ) {
73
+
74
+ var stat ;
75
+
76
+ file = path . normalize ( dir + '/' + file ) ;
77
+
78
+ stat = fs . statSync ( file ) ;
79
+
80
+ if ( stat . isDirectory ( ) && ! file . match ( opts . exception ) ) {
81
+
82
+ files = files . concat ( module . exports . walk ( file , opts ) ) ;
83
+
84
+ } else if ( stat . isFile ( ) && file . match ( opts . match ) && ! file . match ( opts . exception ) ) {
85
+
86
+ files . push ( file ) ;
87
+
88
+ }
89
+
90
+ } ) ;
91
+
92
+ }
93
+
94
+ return files ;
95
+
96
+ } ;
You can’t perform that action at this time.
0 commit comments