
if not Array.prototype.add?
    Object.defineProperty(
        Array.prototype
        'add'
        {}
            value: (item, index) ->
                @splice(index, 0, item)
    )

if not Array.prototype.remove?
    Object.defineProperty(
        Array.prototype
        'remove'
        {}
            value: ->
                for item in arguments
                    let index = @lastIndexOf(item)
                    if index >= 0
                        @splice(index, 1)
    )

# deprecated in favor of includes
# retained temporarily for compatibility with Element.classList.contains method, since IE returns an array
if not Array.prototype.contains?
    Object.defineProperty(
        Array.prototype
        'contains'
        {}
            value: (item) -> @indexOf(item) >= 0
    )

if not Array.prototype.includes?
    Object.defineProperty(
        Array.prototype
        'includes'
        {}
            value: (item) -> @indexOf(item) >= 0
    )