@eweser/db
Version:
eweser-db core database
16 lines (14 loc) • 451 B
text/typescript
import { getLocalRegistry } from '../utils/localStorageService.js';
import type { Database } from '../index.js';
/** if the registry doesn't exist, look for it in the localstorage */
export const getRegistry = (db: Database) => () => {
if (db.registry.length > 0) {
return db.registry;
} else {
const localRegistry = getLocalRegistry(db)();
if (localRegistry) {
db.registry = localRegistry;
}
return db.registry;
}
};