MCPcopy Index your code
hub / github.com/dapi-labs/react-nice-avatar / stringToHashCode

Function stringToHashCode

src/utils.ts:100–110  ·  view source on GitHub ↗
(str: string)

Source from the content-addressed store, hash-verified

98};
99
100const stringToHashCode = (str: string) : number => {
101 if (str.length === 0) return 0
102 let hash = 0
103 let char
104 for (let i = 0; i < str.length; i++) {
105 char = str.charCodeAt(i);
106 hash = ((hash << 5) - hash) + char;
107 hash |= 0; // Convert to 32bit integer
108 }
109 return Math.abs(hash);
110}
111
112type PickByHashCodeOpts = {
113 avoidList?: string[],

Callers 1

genConfigFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…