Reformat code

This commit is contained in:
schmelczerandras 2019-08-24 15:25:43 +02:00
commit 420cd788c4

14
src/app/utils/hash.ts Normal file
View file

@ -0,0 +1,14 @@
export const hashCode = (text: string) => {
let hash = 0;
if (text.length == 0) {
return hash;
}
for (let i = 0; i < text.length; i++) {
const char = text.charCodeAt(i);
hash = (hash << 5) - hash + char;
hash = hash & hash;
}
hash /= Math.pow(2, 32) - 1;
return hash;
};