UNPKG

@palmares/databases

Version:

Add support for working with databases with palmares framework

20 lines (18 loc) 546 B
var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); // src/utils/hash.ts function hashString(stringToHash) { const p = 53; const m = 1e9 + 9; let powerOfP = 1; let hashValue = 0; for (let i = 0; i < stringToHash.length; i++) { hashValue = (hashValue + (stringToHash[i].charCodeAt(0) - "a".charCodeAt(0) + 1) * powerOfP) % m; powerOfP = powerOfP * p % m; } return hashValue.toString(); } __name(hashString, "hashString"); export { hashString };