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

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -