Skip to content

Commit

Permalink
Merge pull request #99 from lindell/new-issue-96
Browse files Browse the repository at this point in the history
Fixed issue #96
  • Loading branch information
lindell authored Sep 3, 2016
2 parents e298b34 + 856f7de commit c31ed76
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/JsBarcode.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ API.prototype.init = function(){
// The render API call. Calls the real render function.
API.prototype.render = function(){
if(Array.isArray(this._renderProperties)){
for(let i in this._renderProperties){
for(var i = 0; i < this._renderProperties.length; i++){
render(this._renderProperties[i], this._encodings, this._options);
}
}
Expand Down
11 changes: 11 additions & 0 deletions test/node/JsBarcode.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,17 @@ describe('Text printing', function() {
});
});

describe('Extended Arrays', function() {
it('should work with extended arrays', function () {
Array.prototype.test = function(){};
Array.prototype._test = "test";

var canvas = new Canvas();
JsBarcode(canvas, "Hello");
JsBarcode(canvas, "HI", {format: "CODE39"});
});
});

describe('Generic barcode', function() {
it('should not fail generic barcode', function () {
var enc = new GENERIC("1234");
Expand Down
4 changes: 2 additions & 2 deletions test/node/help/help.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module.exports.fixBin = function(a){
function mergeToText(encodeData){
if(Array.isArray(encodeData)){
var ret = "";
for(var i in encodeData){
for(var i = 0; i < encodeData.length; i++){
ret += encodeData[i].text || "";
}
return ret;
Expand All @@ -22,7 +22,7 @@ function mergeToText(encodeData){
function mergeToBin(encodeData){
if(Array.isArray(encodeData)){
var ret = "";
for(var i in encodeData){
for(var i = 0; i < encodeData.length; i++){
ret += toBin(encodeData[i].data);
}
return ret;
Expand Down

0 comments on commit c31ed76

Please sign in to comment.