MCPcopy Index your code
hub / github.com/TanStack/db / decodeStorageKey

Function decodeStorageKey

packages/db/src/local-storage.ts:182–191  ·  view source on GitHub ↗

* Decodes a storage key back to its original form. * This is the inverse of encodeStorageKey. * * @param encodedKey - The encoded key from storage * @returns The original key (string or number)

(encodedKey: string)

Source from the content-addressed store, hash-verified

180 * @returns The original key (string or number)
181 */
182function decodeStorageKey(encodedKey: string): string | number {
183 if (encodedKey.startsWith(`n:`)) {
184 return Number(encodedKey.slice(2))
185 }
186 if (encodedKey.startsWith(`s:`)) {
187 return encodedKey.slice(2)
188 }
189 // Fallback for legacy data without encoding
190 return encodedKey
191}
192
193/**
194 * Creates an in-memory storage implementation that mimics the StorageApi interface

Callers 1

loadFromStorageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected