Last active
May 5, 2019 15:39
-
-
Save Tombarr/d449d754f19030e6b67cb60f4090302a to your computer and use it in GitHub Desktop.
Java-like hashCode method for ES6. See https://gist.github.com/hyamamoto/fd435505d29ebfa3d9716fd2be8d42f0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const hashCode = str => Array.from(str) | |
.reduce((h, c) => Math.imul(31, h) + c.charCodeAt(0) | 0, 0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment