UNPKG

@wxn0brp/db

Version:

A simple file-based database management system with support for CRUD operations, custom queries, and graph structures.

19 lines (18 loc) 742 B
import ValtheraRemote from "../client/valthera.js"; import Valthera from "../db/valthera.js"; /** * Creates a database instance based on the provided configuration. * If the configuration is an object, it creates a DataBaseRemote instance. * If the configuration is a string starting with "http", it also creates a DataBaseRemote instance. * Otherwise, it creates a DataBase instance. * * @param cfg - The configuration object or string for the database. * @returns A new instance of DataBaseRemote or DataBase. */ export function ValtheraAutoCreate(cfg) { if (typeof cfg === "object") return new ValtheraRemote(cfg); if (cfg.startsWith("http")) return new ValtheraRemote(cfg); return new Valthera(cfg); }