Skip to content

Commit ea370b2

Browse files
authoredAug 12, 2021
Merge pull request #76 from jcubic/hasOwnProperty
add hasOwnProperty checks to for loops
2 parents 89009f8 + aca9253 commit ea370b2

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed
 

‎lib/figlet.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -896,13 +896,17 @@ var figlet = figlet || (function() {
896896
if (typeof options.horizontalLayout !== 'undefined') {
897897
params = getHorizontalFittingRules(options.horizontalLayout, fontOpts);
898898
for (prop in params) {
899-
myOpts.fittingRules[prop] = params[prop];
899+
if (params.hasOwnProperty(prop)) {
900+
myOpts.fittingRules[prop] = params[prop];
901+
}
900902
}
901903
}
902904
if (typeof options.verticalLayout !== 'undefined') {
903905
params = getVerticalFittingRules(options.verticalLayout, fontOpts);
904906
for (prop in params) {
905-
myOpts.fittingRules[prop] = params[prop];
907+
if (params.hasOwnProperty(prop)) {
908+
myOpts.fittingRules[prop] = params[prop];
909+
}
906910
}
907911
}
908912
myOpts.printDirection = (typeof options.printDirection !== 'undefined') ? options.printDirection : fontOpts.printDirection;
@@ -1131,7 +1135,9 @@ var figlet = figlet || (function() {
11311135
});
11321136
}, Promise.resolve()).then(function(res){
11331137
for(var i in fonts){
1134-
me.parseFont(fonts[i], fontData[i]);
1138+
if (fonts.hasOwnProperty(i)) {
1139+
me.parseFont(fonts[i], fontData[i]);
1140+
}
11351141
}
11361142

11371143
if(next)next();

0 commit comments

Comments
 (0)
Please sign in to comment.