Skip to content

Commit

Permalink
Merge pull request #76 from jcubic/hasOwnProperty
Browse files Browse the repository at this point in the history
add hasOwnProperty checks to for loops
  • Loading branch information
patorjk authored Aug 12, 2021
2 parents 89009f8 + aca9253 commit ea370b2
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/figlet.js
Original file line number Diff line number Diff line change
Expand Up @@ -896,13 +896,17 @@ var figlet = figlet || (function() {
if (typeof options.horizontalLayout !== 'undefined') {
params = getHorizontalFittingRules(options.horizontalLayout, fontOpts);
for (prop in params) {
myOpts.fittingRules[prop] = params[prop];
if (params.hasOwnProperty(prop)) {
myOpts.fittingRules[prop] = params[prop];
}
}
}
if (typeof options.verticalLayout !== 'undefined') {
params = getVerticalFittingRules(options.verticalLayout, fontOpts);
for (prop in params) {
myOpts.fittingRules[prop] = params[prop];
if (params.hasOwnProperty(prop)) {
myOpts.fittingRules[prop] = params[prop];
}
}
}
myOpts.printDirection = (typeof options.printDirection !== 'undefined') ? options.printDirection : fontOpts.printDirection;
Expand Down Expand Up @@ -1131,7 +1135,9 @@ var figlet = figlet || (function() {
});
}, Promise.resolve()).then(function(res){
for(var i in fonts){
me.parseFont(fonts[i], fontData[i]);
if (fonts.hasOwnProperty(i)) {
me.parseFont(fonts[i], fontData[i]);
}
}

if(next)next();
Expand Down

0 comments on commit ea370b2

Please sign in to comment.