sequaljs
Version:
JavaScript/TypeScript library for parsing and manipulating ProForma peptide sequence notation
19 lines (18 loc) • 529 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.calculateHashCode = calculateHashCode;
/**
* Calculates the hash code of a string.
*
* @param input - The string to calculate the hash code for.
* @returns The hash code.
*/
function calculateHashCode(input) {
let hash = 0;
for (let i = 0; i < input.length; i++) {
const char = input.charCodeAt(i);
hash = (hash << 5) - hash + char;
hash = hash & hash; // Convert to 32-bit integer
}
return hash;
}