Skip to content

Conversation

@jackdwalker
Copy link
Contributor

Thanks for submitting a PR! Please fill in this template where appropriate:

Category

Bug

Feature/Issue Description

This PR removes a bug that was described in issue 1909.

Describe What Changes

As per my description of the issue in the issue itself:

As suggested by bcoles I did a bit of digging and found a cleaner jQuery alternative to address the problem that the Array.prototype.unique function was solving.

function unique(array) {
    return $.grep(array, function(el, index) {
        return index === $.inArray(el, array);
    });
}

The code snippet shared above by l0kihardt should now result in the expected behaviour:

let a = [{}, {}, {}];

for(i in a){
    console.log(i);
}

// OUTPUT
0 
1
2

Test Cases

Tests are passing and I haven't noticed any other issues/bugs caused by this change.

Relevant Wiki Page

N/A

@jackdwalker jackdwalker linked an issue Jul 6, 2020 that may be closed by this pull request
@bcoles
Copy link
Collaborator

bcoles commented Jul 7, 2020

🤷 works for me. The events extension will have to be updated to support websockets c&c one day anyway.

I presume that prototyping Array was overwriting the beef.logger.stream array. Maybe. Regardless, it is best that the prototyping code be vaporised asap.

Copy link
Contributor

@jcrew99 jcrew99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great

@jcrew99
Copy link
Contributor

jcrew99 commented Jul 7, 2020

Works for me as well, with bcoles happy as well i will merge it : D Great work @jackdwalker

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Why there is a key whose name is "unique"?

4 participants