javascript - How to "fuzzy" fingerprint an array -
for current project need find way "fuzzy" - fingerprint javascript array client-side.
the problem elements inside array can change on time. change mean order stable elements may removed , others included. need find way produces same fingerprint (within given threshold).
i'm thinking kind of partial match implementation i'm curious how others it.
you wrap array object , add modification counter object. on each array modification must increment modification counter. defining treshold array modifications, can make decisions.
var fuzzyarray = { data : [], modcount : 0, changeelement : function (elementid, newdata){ data[elementid] = newdata; modcount++; } }; //adding elements... fuzzyarray.changeelement(1,"foo"); if (fuzzyarray.modcount > treshold){ // }
Comments
Post a Comment