1 2 3 4 5 6 7 8 9 10
export default function hashString(string: string): string { let hash = 0; for (const character of string) { // eslint-disable-next-line no-bitwise hash = ((hash << 5) - hash) + character.codePointAt(0)!; } return String(Math.trunc(hash)); }