Hash Strings
JS
S
JavaScriptFunction to generate number hashes from strings
1const hashCode = (s: string) => s.split('').reduce((a, b) => ((a << 5) - a + b.charCodeAt(0)) | 0, 0);
2export { hashCode };
3Created on 7/13/2021
Function to generate number hashes from strings
1const hashCode = (s: string) => s.split('').reduce((a, b) => ((a << 5) - a + b.charCodeAt(0)) | 0, 0);
2export { hashCode };
3Created on 7/13/2021