UNPKG

sutando

Version:

A modern Node.js ORM. Makes it enjoyable to interact with your database. Support Mysql, MSSql, MariaDB, Sqlite.

34 lines (27 loc) 611 B
class Relation { parent; related; eagerKeysWereEmpty = false; static constraints = true constructor(related, parent) { this.parent = parent; this.related = related; } asProxy() { const handler = { get: function (target, prop) { if (typeof target[prop] !== 'undefined') { return target[prop] } if (typeof prop === 'string') { return () => target.asProxy(); } }, } return new Proxy(this, handler) } getRelated() { return this.related; } } module.exports = Relation;