nosqlax
Version:
NoSQLax is a modern, lightweight JavaScript Object Document Mapper(ODM) library that makes working with CouchDB a breeze. Inspired by CouchDB’s “Relax” philosophy and the chill vibes of Snorlax, NoSQLax takes the hassle out of managing your data, offering
21 lines (20 loc) • 815 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = createRepository;
const CouchRepository_1 = __importDefault(require("./CouchRepository"));
function createRepository(entityClass, ds, config) {
// Create the dynamic repository class
const DynamicRepoClass = class extends CouchRepository_1.default {
constructor() {
super(ds, config === null || config === void 0 ? void 0 : config.ajvOptions, entityClass);
}
};
// Attach instance methods if provided
if (config.methods) {
Object.assign(DynamicRepoClass.prototype, config.methods);
}
return new DynamicRepoClass();
}