MCPcopy Create free account
hub / github.com/Xyntopia/taskyon / hashCode

Function hashCode

src/modules/localVectorStore.ts:19–27  ·  view source on GitHub ↗

* Returns a hash code from a string * @param {String} str The string to hash. * @return {Number} A 32bit integer * @see http://werxltd.com/wp/2010/05/13/javascript-implementation-of-javas-string-hashcode-method/

(str: string)

Source from the content-addressed store, hash-verified

17 * @see http://werxltd.com/wp/2010/05/13/javascript-implementation-of-javas-string-hashcode-method/
18 */
19function hashCode(str: string) {
20 let hash = 0;
21 for (let i = 0, len = str.length; i < len; i++) {
22 const chr = str.charCodeAt(i);
23 hash = (hash << 5) - hash + chr;
24 hash |= 0; // Convert to 32bit integer
25 }
26 return hash;
27}
28
29async function loadIndex(
30 numDimensions: number,

Callers 1

uploadToIndexFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected