From 5908f14cfcae814e592abeaae39248aeff6942dd Mon Sep 17 00:00:00 2001 From: Slava Bacherikov Date: Sun, 22 Jan 2012 10:23:44 +0200 Subject: [PATCH] Add function getUnique for array. --- decrypt_bios.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/decrypt_bios.js b/decrypt_bios.js index 4faeaec..4b2cd1b 100644 --- a/decrypt_bios.js +++ b/decrypt_bios.js @@ -110,6 +110,18 @@ Array.prototype.swap = function (x,y) { return this; } +Array.prototype.getUnique = function(){ + var u = {}, a = []; + for(var i = 0, l = this.length; i < l; ++i){ + if(this[i] in u){ + continue; + } + a.push(this[i]); + u[this[i]] = 1; + } + return a; +} + if(typeof(String.prototype.trim) === "undefined"){ String.prototype.trim = function() { return String(this).replace(/^\s+|\s+$/g, ''); @@ -1018,7 +1030,7 @@ function metaDellManyTag(serial, len, key, func){ return false; } var r_ob = new Object(); - r_ob[key] = answ_arr; + r_ob[key] = answ_arr.getUnique(); return r_ob; } else { return false;