Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2017-06-06 21:36:17 +03:00
parent a6417bdf77
commit 7848f3a4fd

View File

@ -46,6 +46,8 @@ Array.prototype.compact = function(){
// return an array with duplicate elements removed... // return an array with duplicate elements removed...
// //
// NOTE: we are not using an Object as an index here as an Array can
// contain any type of item while Object keys can only be strings...
Array.prototype.unique = function(normalize){ Array.prototype.unique = function(normalize){
if(normalize){ if(normalize){
var cache = this.map(function(e){ return normalize(e) }) var cache = this.map(function(e){ return normalize(e) })