apply color categories to sender profile name
This commit is contained in:
parent
2a264f36b7
commit
f2efbc15f4
5 changed files with 63 additions and 21 deletions
|
@ -37,3 +37,24 @@ export function formatCount(count) {
|
|||
export function formatCryptoKey(key) {
|
||||
return key.match(/.{1,4}/g).join(" ");
|
||||
}
|
||||
/**
|
||||
* calculates a numeric hash for a given string
|
||||
*
|
||||
* @param {string} str string to hash
|
||||
*
|
||||
* @return {number}
|
||||
*/
|
||||
export function hashCode(str) {
|
||||
let hash = 0;
|
||||
let i;
|
||||
let chr;
|
||||
if (str.length === 0) {
|
||||
return hash;
|
||||
}
|
||||
for (i = 0; i < str.length; i++) {
|
||||
chr = str.charCodeAt(i);
|
||||
hash = ((hash << 5) - hash) + chr;
|
||||
hash |= 0;
|
||||
}
|
||||
return Math.abs(hash);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue