← Files RivetARCHIVED FILE

node_modules/drizzle-orm/entity.cjs

938 Bytes · Nov 5, 2026 · 12:09 UTC

↓ Download file

Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });

//#region src/entity.ts
const entityKind = Symbol.for("drizzle:entityKind");
const hasOwnEntityKind = Symbol.for("drizzle:hasOwnEntityKind");
function is(value, type) {
	if (!value || typeof value !== "object") return false;
	if (value instanceof type) return true;
	if (!Object.prototype.hasOwnProperty.call(type, entityKind)) throw new Error(`Class "${type.name ?? "<unknown>"}" doesn't look like a Drizzle entity. If this is incorrect and the class is provided by Drizzle, please report this as a bug.`);
	let cls = Object.getPrototypeOf(value)?.constructor;
	if (cls) while (cls) {
		if (entityKind in cls && cls[entityKind] === type[entityKind]) return true;
		cls = Object.getPrototypeOf(cls);
	}
	return false;
}

//#endregion
exports.entityKind = entityKind;
exports.hasOwnEntityKind = hasOwnEntityKind;
exports.is = is;
//# sourceMappingURL=entity.cjs.map

SHA-256: c79f6c2cc56f5fe4d1517a1dd1a757d93059cd20ca597c7a0e6d19a85a55946b