Skip to content

Commit

Permalink
Merge branch 'master' of github.com:teleportd/cell.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Anthony MOI committed May 9, 2012
2 parents 884eba9 + 9dbb970 commit 9017e02
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cell-0.3.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions src/base.js
Expand Up @@ -167,6 +167,31 @@ CELL.remove = function(that, e) {
if(e === that[i]) that.splice(i, 1);
};

/**
* unique()
* Returns a new array by removing duplicate elements
* using the JS '===' equality
*/
CELL.unique = function(that) {
"use strict";

if(that === void 0 || that === null || !Array.isArray(that))
throw new TypeError();

var a = that.concat();
for(var i = 0; i < a.length; i++) {
for(var j = i+1; j < a.length; j++) {
if(a[i] === a[j]) {
a.splice(j, 1);
j--;
}
}
}
return a;
};



CELL.DEBUG = false;

CELL.debug = function() {
Expand Down

0 comments on commit 9017e02

Please sign in to comment.