CoolFace
Apppublic

AK-21/Graphite-Industrial-Intelligence

sourceHugging Faceupdated 3mo agoView on Hugging Face
0likes
entity.js31 linesDownload Raw Back to drizzle-orm
1const entityKind = Symbol.for("drizzle:entityKind");2const hasOwnEntityKind = Symbol.for("drizzle:hasOwnEntityKind");3function is(value, type) {4  if (!value || typeof value !== "object") {5    return false;6  }7  if (value instanceof type) {8    return true;9  }10  if (!Object.prototype.hasOwnProperty.call(type, entityKind)) {11    throw new Error(12      `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.`13    );14  }15  let cls = Object.getPrototypeOf(value).constructor;16  if (cls) {17    while (cls) {18      if (entityKind in cls && cls[entityKind] === type[entityKind]) {19        return true;20      }21      cls = Object.getPrototypeOf(cls);22    }23  }24  return false;25}26export {27  entityKind,28  hasOwnEntityKind,29  is30};31//# sourceMappingURL=entity.js.map