Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$.Array.unique #38

Closed
RubyLouvre opened this issue Dec 27, 2012 · 0 comments
Closed

$.Array.unique #38

RubyLouvre opened this issue Dec 27, 2012 · 0 comments

Comments

@RubyLouvre
Copy link
Owner

利用es6的新集合对象提高性能

 if(this.Set){
        $.Array.unique = function(target){
            var set = new Set, ret = [], n = target.length;
            for (var i = 0, el; i < n; i++) {
                el = target[i]
                if(!set.has(el)){
                    set.add(el)
                    ret.push(el);
                }
            }
            return ret;
        }
    }
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

No branches or pull requests

1 participant