ThatAIguyA world of ideas

THE CONSCIOUSNESS ATLAS
Read. Experiment. Follow the evidence.

ConsciousnessLearn · Explore · Joseph Anady

Janady13/llms-txt-hub / apps/web/lib/favorites.ts

Source identity, revision, and recovered contents.

GitHub sourceSource text recovered

Source identity

FieldRecorded value
Source typeGitHub source
Original recordJanady13/llms-txt-hub / apps/web/lib/favorites.ts
DateNot specified in source
RepositoryJanady13/llms-txt-hub
Revisione0f4bf978d4df168369c7601d9c5f5ea89e84377
Branchmain
Path or archive memberapps/web/lib/favorites.ts
Original SHA-25622a293310d806e4ba639bbd36448bb126a16ca9d7b27c2c38d10c69892864fac
Git blob SHA2d38fb80efd21ff807691822e0c5202c26e4726e
Reading-copy SHA-25622a293310d806e4ba639bbd36448bb126a16ca9d7b27c2c38d10c69892864fac

Original source ↗

Recovered source transcript

// Core favorites management logic import { logger } from '@thedaviddias/logging' export const FAVORITES_STORAGE_KEY = 'llms-hub-favorites' export const FAVORITES_VERSION = 1 export interface FavoritesData { favorites: string[] lastUpdated: string version: number } export function getFavoritesFromStorage(): string[] { if (typeof window === 'undefined') return [] try { const stored = localStorage.getItem(FAVORITES_STORAGE_KEY) if (!stored) return [] const data: FavoritesData = JSON.parse(stored) // Handle version migrations here if needed return data.favorites || [] } catch (error) { logger.error('Error reading favorites from storage:', { data: error, tags: { type: 'library' } }) return [] } } export function saveFavoritesToStorage(favorites: string[]): void { if (typeof window === 'undefined') return try { const data: FavoritesData = { favorites, lastUpdated: new Date().toISOString(), version: FAVORITES_VERSION } localStorage.setItem(FAVORITES_STORAGE_KEY, JSON.stringify(data)) } catch (error) { logger.error('Error saving favorites to storage:', { data: error, tags: { type: 'library' } }) } } export function toggleFavorite(slug: string, currentFavorites: string[]): string[] { const index = currentFavorites.indexOf(slug) if (index > -1) { // Remove from favorites return currentFavorites.filter(s => s !== slug) } else { // Add to favorites return [...currentFavorites, slug] } } // Merge favorites from different sources (for sync logic) export function mergeFavorites(local: string[], remote: string[]): string[] { const merged = new Set([...local, ...remote]) return Array.from(merged) }

Search equations, builds, manuscript text, and recovered sources.