(text: string, hash: number = 0)
| 1 | export const hashCode = (text: string, hash: number = 0) => { |
| 2 | for (let i = 0; i < text.length; i++) { |
| 3 | const chr = text.charCodeAt(i); |
| 4 | hash = (hash << 5) - hash + chr; |
| 5 | hash |= 0; // Convert to 32bit integer |
| 6 | } |
| 7 | return Number(Math.abs(hash)).toString(36); |
| 8 | }; |
no test coverage detected