Skip to content

Instantly share code, notes, and snippets.

@h3h h3h/gist:605546
Created Oct 1, 2010

Embed
What would you like to do?
if (!Array.prototype.uniq)
{
Array.prototype.uniq = function(fun)
{
var seen = {};
return this.filter(function (el) {
var key = typeof (fun) == "function" ? fun(el) : el;
var r = !seen[key];
seen[key] = true;
return r;
});
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.