MCPcopy
hub / github.com/darkreader/darkreader / getHashCode

Function getHashCode

src/utils/text.ts:78–86  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

76}
77
78export function getHashCode(text: string): number {
79 const len = text.length;
80 let hash = 0;
81 for (let i = 0; i < len; i++) {
82 const c = text.charCodeAt(i);
83 hash = ((hash << 5) - hash + c) & 4294967295;
84 }
85 return hash;
86}
87
88export function escapeRegExpSpecialChars(input: string): string {
89 return input.replaceAll(/[\^$.*+?\(\)\[\]{}|\-\\]/g, '\\$&');

Callers 2

getStyleRuleHashFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected