@clickup/ent-framework
Version:
A PostgreSQL graph-database-alike library with microsharding and row-level security
16 lines • 550 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.objectId = objectId;
const $OBJECT_ID = Symbol("$OBJECT_ID");
let seq = 0;
/**
* Mimics the behavior of Python's `id()` function. The idea is that often times
* we can't use e.g. obj.constructor.name, because it got mangled by e.g.
* UglifyJS during bundling. But to build cache keys, we still need some
* per-object identifier.
*/
function objectId(objIn) {
const obj = objIn;
return (obj[$OBJECT_ID] ??= seq++);
}
//# sourceMappingURL=objectId.js.map
;