Skip to content

Instantly share code, notes, and snippets.

@supahfunk
Created November 6, 2019 09:17
Show Gist options
  • Save supahfunk/5a941e19e6329ab4f47b12e9ec8b1dd8 to your computer and use it in GitHub Desktop.
Save supahfunk/5a941e19e6329ab4f47b12e9ec8b1dd8 to your computer and use it in GitHub Desktop.
Hash
const hash = value => {
let hashed = 0;
for (let i = 0; i < value.length; i += 1) {
hashed = (hashed << 5) - hashed + value.charCodeAt(i);
hashed |= 0;
}
return `${hashed}`;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment