MCPcopy Create free account
hub / github.com/TanStack/db / hashCollectionId

Function hashCollectionId

packages/db-sqlite-persistence-core/src/persisted.ts:2785–2794  ·  view source on GitHub ↗
(collectionId: string)

Source from the content-addressed store, hash-verified

2783const PERSISTED_TABLE_NAME_ALPHABET = `abcdefghijklmnopqrstuvwxyz234567`
2784
2785function hashCollectionId(collectionId: string): number {
2786 let hash = 0x811c9dc5
2787
2788 for (let index = 0; index < collectionId.length; index++) {
2789 hash ^= collectionId.charCodeAt(index)
2790 hash = Math.imul(hash, 0x01000193)
2791 }
2792
2793 return hash >>> 0
2794}
2795
2796function toBase32(input: number): string {
2797 if (input === 0) {

Callers 1

createPersistedTableNameFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected