Skip to content

Commit

Permalink
Avoid loading partial files when partial value is undefined/null/false
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Ip committed Aug 11, 2017
1 parent 894b0de commit 8690e80
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/consolidate.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ function readPartials(path, options, fn) {
function next(index) {
if (index === keys.length) return fn(null);
var key = keys[index];
var filename = partials[key];
if (filename === undefined || filename === null || filename === false) {
return next(++index);
}
var file = join(dirname(path), partials[key] + extname(path));
read(file, options, function(err, str){
if (err) return fn(err);
Expand Down

0 comments on commit 8690e80

Please sign in to comment.