UNC-Libraries / jquery.xmleditor

jQuery based XML editor plugin.
153 stars 71 forks source link

xsd2json: Typo in SchemaManager.mergeType() #88

Closed vog closed 7 years ago

vog commented 7 years ago

There is a type in SchemaManager.mergeType():

SchemaManager.prototype.mergeType = function(base, type) {
    for (var key in type) {
        if (type.hasOwnProperty(key)) {
            var value = type[key];
            if (value != null && base[key] == null){
                base[key] = value;
            } else if ($.isArray(value) && $.isArray(type[key])){
                base[key] = base[key].concat(value);
            }
        }
    }
};

The following check is redundant, as value is defined to be type[key].

            } else if ($.isArray(value) && $.isArray(type[key])){

It seems that base[key] is meant instead.

I'm not aware of any actual test case that may actually trigger this issue, but better safe than sorry.