MCPcopy Create free account
hub / github.com/QwikDev/qwik / hashCode

Function hashCode

packages/qwik/src/core/util/hash_code.ts:1–8  ·  view source on GitHub ↗
(text: string, hash: number = 0)

Source from the content-addressed store, hash-verified

1export const hashCode = (text: string, hash: number = 0) => {
2 for (let i = 0; i < text.length; i++) {
3 const chr = text.charCodeAt(i);
4 hash = (hash << 5) - hash + chr;
5 hash |= 0; // Convert to 32bit integer
6 }
7 return Number(Math.abs(hash)).toString(36);
8};

Callers 3

styleKeyFunction · 0.90
useIdFunction · 0.90
createOutputAnalyzerFunction · 0.90

Calls 1

toStringMethod · 0.45

Tested by

no test coverage detected