Skip to content

Commit fe6206b

Browse files
committed
make process_pattern_iterative() return the oPattern to make it a little
more functional, which seems nice for unit tests; incorporate @sghoweri's fix to the pattern_assembler
1 parent 5cab80b commit fe6206b

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

builder/pattern_assembler.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
}
7878

7979
// skip non-pattern files
80-
if (!patternEngines.isPatternFile(filename, patternlab)) { return; }
80+
if (!patternEngines.isPatternFile(filename, patternlab)) { return null; }
8181
if (config.debug) {
8282
console.log('processPatternIterative:', 'found pattern', file);
8383
}
@@ -92,15 +92,15 @@
9292
//the object in the next diveSync
9393
addPattern(currentPattern, patternlab);
9494
//no need to process further
95-
return;
95+
return currentPattern;
9696
}
9797

98-
//can ignore all non-mustache files at this point
99-
if(ext !== '.mustache'){
98+
//can ignore all non-supported files at this point
99+
if(patternEngines.isFileExtensionSupported(ext) === false){
100100
if (config.debug) {
101101
console.log('==================== FOUND NON-MUSTACHE FILE');
102102
}
103-
return;
103+
return currentPattern;
104104
}
105105

106106
//see if this file has a state
@@ -140,6 +140,8 @@
140140

141141
//add currentPattern to patternlab.patterns array
142142
addPattern(currentPattern, patternlab);
143+
144+
return currentPattern;
143145
}
144146

145147

@@ -297,7 +299,7 @@
297299
return renderPattern(template, data, partials);
298300
},
299301
process_pattern_iterative: function(file, patternlab){
300-
processPatternIterative(file, patternlab);
302+
return processPatternIterative(file, patternlab);
301303
},
302304
process_pattern_recursive: function(file, patternlab, additionalData){
303305
processPatternRecursive(file, patternlab, additionalData);

0 commit comments

Comments
 (0)