Skip to content

Instantly share code, notes, and snippets.

@bga
Created May 7, 2010 22:08
Show Gist options
  • Save bga/394053 to your computer and use it in GitHub Desktop.
Save bga/394053 to your computer and use it in GitHub Desktop.
var _nodeUnique = function (nodeArray)
{
var len = nodeArray.length, i = 0;
while (i < len && nodeArray[i] !== nodeArray[++i])
;
if(i >= len)
return nodeArray;
var j = --i, v;
while(i < len)
{
v = nodeArray[j++] = nodeArray[i];
while (++i < len && v === nodeArray[i])
;
}
nodeArray.length = j;
return nodeArray;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment