Skip to content

Will not work with any other library that uses the Array 'in' operator #12

@franzwilding

Description

@franzwilding

In undex-vue.js you create a new array property 'remove' as enumerable property.

Array.prototype.remove = function(item) {
      if(!this.length) return
      const idx = this.indexOf(item);
      if(idx > -1) return this.splice(idx,1)
}

Because of this every Array will have a new property 'remove' with the function as value when getting the Array properties by:

for(x in array) {}

This breaks for examle jQuery ajaxForm and many other libraries.

Please declare the remove method as non enumerable:

Object.defineProperty(Array.prototype, 'remove', { 
    enumerable: false,
    value: function(item) {
      if(!this.length) return
      const idx = this.indexOf(item);
      if(idx > -1) return this.splice(idx,1)
    }

});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions