Subversion Repositories Applications.dictionnaire

Compare Revisions

Ignore whitespace Rev 9 → Rev 11

/scripts/helpers.js
15,34 → 15,6
return proche;
}
 
// http://stackoverflow.com/questions/1960473/unique-values-in-an-array
function getUnique(tableau) {
var u = {}, a = [];
for(var i = 0, l = tableau.length; i < l; ++i){
if(u.hasOwnProperty(tableau[i])) {
continue;
}
a.push(tableau[i]);
u[tableau[i]] = 1;
}
return a;
}
 
// http://stackoverflow.com/questions/281264/remove-empty-elements-from-an-array-in-javascript
function clean(tableau, deleteValue) {
for (var i = 0; i < tableau.length; i++) {
if (tableau[i] == deleteValue) {
tableau.splice(i, 1);
i--;
}
}
return tableau;
}
 
function trim(myString) {
return myString.replace(/^\s+/g,'').replace(/\s+$/g,'')
}
 
function levenshtein (s1, s2) {
// http://kevin.vanzonneveld.net
// + original by: Carlos R. L. Rodrigues (http://www.jsfromhell.com)
113,4 → 85,3
}
return v0[s1_len];
}